Skip to content

Commit

Permalink
update typing
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug committed Jun 29, 2024
1 parent 1f86be4 commit 976f559
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions hypothesis-python/src/hypothesis/internal/conjecture/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ class PrimitiveProvider(abc.ABC):
def __init__(self, conjecturedata: Optional["ConjectureData"], /) -> None:
self._cd = conjecturedata

def post_test_case_hook(self, value):
def post_test_case_hook(self, value: IRType) -> IRType:
# hook for providers to modify values returned by draw_* after a full
# test case concludes. Originally exposed for crosshair to reify its
# symbolic values into actual values.
Expand Down Expand Up @@ -1966,7 +1966,9 @@ def __init__(
self.max_depth = 0
self.has_discards = False

self.provider = provider(self) if isinstance(provider, type) else provider
self.provider: PrimitiveProvider = (
provider(self) if isinstance(provider, type) else provider
)
assert isinstance(self.provider, PrimitiveProvider)

self.__result: "Optional[ConjectureResult]" = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def test_function(self, data: ConjectureData) -> None:
raise HypothesisException(
f"expected {expected_type} from "
f"{data.provider.post_test_case_hook.__qualname__}, "
f"got {type(value)} ({value})"
f"got {type(value)} ({value!r})"
)
node.value = value

Expand Down

0 comments on commit 976f559

Please sign in to comment.