Skip to content

Commit d4665b9

Browse files
committed
Fix type annotation
1 parent 3d34092 commit d4665b9

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

hypothesis-python/RELEASE.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
RELEASE_TYPE: minor
22

3-
Deprecate use of :func:`~hypothesis.assume` and ``reject()``
3+
This release deprecates use of :func:`~hypothesis.assume` and ``reject()``
44
outside of property-based tests, because these functions work by raising a
5-
special exception (:issue:`3743`).
5+
special exception (:issue:`3743`). It also fixes some type annotations
6+
(:issue:`3753`).

hypothesis-python/src/hypothesis/strategies/_internal/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
from hypothesis.strategies._internal.shared import SharedStrategy
123123
from hypothesis.strategies._internal.strategies import (
124124
Ex,
125+
Ex_Inv,
125126
SampledFromStrategy,
126127
T,
127128
one_of,
@@ -1136,7 +1137,7 @@ def builds(
11361137

11371138
@cacheable
11381139
@defines_strategy(never_lazy=True)
1139-
def from_type(thing: Type[Ex]) -> SearchStrategy[Ex]:
1140+
def from_type(thing: Type[Ex_Inv]) -> SearchStrategy[Ex_Inv]:
11401141
"""Looks up the appropriate search strategy for the given type.
11411142
11421143
``from_type`` is used internally to fill in missing arguments to

whole-repo-tests/test_mypy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def convert_lines():
126126
"tuples(text(), text(), text(), text(), text(), text())",
127127
"tuple[Any, ...]",
128128
),
129+
(
130+
"from_type(type).flatmap(from_type).filter(lambda x: not isinstance(x, int))",
131+
"Ex_Inv`-1",
132+
),
129133
],
130134
)
131135
def test_revealed_types(tmpdir, val, expect):

0 commit comments

Comments
 (0)