Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsokl committed Dec 4, 2022
1 parent 267d014 commit 2814f29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hypothesis-python/src/hypothesis/internal/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import platform
import sys
import typing
from typing import Any, ForwardRef, List, Tuple, Union
from typing import Any, ForwardRef, Tuple

try:
from typing import get_args
Expand All @@ -23,7 +23,7 @@

def get_args(
tp: Any,
) -> Union[Tuple[type, ...], Tuple[List[type], type]]: # pragma: no cover
) -> Tuple[Any, ...]: # pragma: no cover
"""
Examples
--------
Expand Down Expand Up @@ -155,13 +155,14 @@ def get_type_hints(thing):
isinstance(sig_hint, ForwardRef)
and not isinstance(hint, ForwardRef)
for sig_hint, hint in zip(
_hint_and_args(p.annotation), _hint_and_args(hints[p.name])
_hint_and_args(p.annotation),
_hint_and_args(hints.get(p.name, Any)),
)
):
p_hint = hints[p.name]

print(p_hint, p.default)
if p.default is None:
hints[p.name] = typing.Optional[p_hint] # type: ignore
hints[p.name] = typing.Optional[p_hint]
else:
hints[p.name] = p_hint
except (AttributeError, TypeError, NameError): # pragma: no cover
Expand Down
1 change: 1 addition & 0 deletions hypothesis-python/tests/cover/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Foo:
"x",
Parameter.POSITIONAL_OR_KEYWORD,
annotation=ForwardRef("Foo"),
default=None,
)
]
)
Expand Down

0 comments on commit 2814f29

Please sign in to comment.