Skip to content

Commit

Permalink
Fix type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Sep 24, 2023
1 parent 3d34092 commit d4665b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions hypothesis-python/RELEASE.rst
@@ -1,5 +1,6 @@
RELEASE_TYPE: minor

Deprecate use of :func:`~hypothesis.assume` and ``reject()``
This release deprecates use of :func:`~hypothesis.assume` and ``reject()``
outside of property-based tests, because these functions work by raising a
special exception (:issue:`3743`).
special exception (:issue:`3743`). It also fixes some type annotations
(:issue:`3753`).
Expand Up @@ -122,6 +122,7 @@
from hypothesis.strategies._internal.shared import SharedStrategy
from hypothesis.strategies._internal.strategies import (
Ex,
Ex_Inv,
SampledFromStrategy,
T,
one_of,
Expand Down Expand Up @@ -1136,7 +1137,7 @@ def builds(

@cacheable
@defines_strategy(never_lazy=True)
def from_type(thing: Type[Ex]) -> SearchStrategy[Ex]:
def from_type(thing: Type[Ex_Inv]) -> SearchStrategy[Ex_Inv]:
"""Looks up the appropriate search strategy for the given type.
``from_type`` is used internally to fill in missing arguments to
Expand Down
4 changes: 4 additions & 0 deletions whole-repo-tests/test_mypy.py
Expand Up @@ -126,6 +126,10 @@ def convert_lines():
"tuples(text(), text(), text(), text(), text(), text())",
"tuple[Any, ...]",
),
(
"from_type(type).flatmap(from_type).filter(lambda x: not isinstance(x, int))",
"Ex_Inv`-1",
),
],
)
def test_revealed_types(tmpdir, val, expect):
Expand Down

0 comments on commit d4665b9

Please sign in to comment.