Skip to content

Commit

Permalink
Explicitly type in tests, now that mypy infers iterations on tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose committed Oct 17, 2024
1 parent 2fc2b5d commit ad7cb28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/media/test_oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#

import json
from typing import Any

from parameterized import parameterized

Expand Down Expand Up @@ -52,6 +53,7 @@ def parse_response(self, response: JsonDict) -> OEmbedResult:

def test_version(self) -> None:
"""Accept versions that are similar to 1.0 as a string or int (or missing)."""
version: Any
for version in ("1.0", 1.0, 1):
result = self.parse_response({"version": version})
# An empty Open Graph response is an error, ensure the URL is included.
Expand All @@ -69,6 +71,7 @@ def test_version(self) -> None:

def test_cache_age(self) -> None:
"""Ensure a cache-age is parsed properly."""
cache_age: Any
# Correct-ish cache ages are allowed.
for cache_age in ("1", 1.0, 1):
result = self.parse_response({"cache_age": cache_age})
Expand Down
2 changes: 2 additions & 0 deletions tests/push/test_push_rule_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def test_exact_event_match_boolean(self) -> None:
{"value": False},
"incorrect values should not match",
)
value: Any
for value in ("foobaz", 1, 1.1, None, [], {}):
self._assert_not_matches(
condition,
Expand Down Expand Up @@ -494,6 +495,7 @@ def test_exact_event_match_null(self) -> None:
{"value": None},
"exact value should match",
)
value: Any
for value in ("foobaz", True, False, 1, 1.1, [], {}):
self._assert_not_matches(
condition,
Expand Down

0 comments on commit ad7cb28

Please sign in to comment.