File tree 3 files changed +11
-3
lines changed
src/hypothesis/strategies/_internal
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change
1
+ RELEASE_TYPE: patch
2
+
3
+ This patch restores diversity to the outputs of
4
+ :func: `from_type(type) <hypothesis.strategies.from_type> ` (:issue: `4144 `).
Original file line number Diff line number Diff line change @@ -822,9 +822,7 @@ def really_inner(thing):
822
822
@register ("Type" )
823
823
@register ("Type" , module = typing_extensions )
824
824
def resolve_Type (thing ):
825
- if getattr (thing , "__args__" , None ) is None :
826
- return st .just (type )
827
- elif get_args (thing ) == (): # pragma: no cover
825
+ if getattr (thing , "__args__" , None ) is None or get_args (thing ) == ():
828
826
return _fallback_type_strategy
829
827
args = (thing .__args__ [0 ],)
830
828
if is_a_union (args [0 ]):
Original file line number Diff line number Diff line change 11
11
from hypothesis import given , strategies as st
12
12
from hypothesis .strategies ._internal .types import _global_type_lookup
13
13
14
+ from tests .common .debug import find_any
15
+
14
16
TYPES = sorted (
15
17
(
16
18
x
@@ -39,3 +41,7 @@ def everything_except(excluded_types):
39
41
def test_recipe_for_everything_except (excluded_types , data ):
40
42
value = data .draw (everything_except (excluded_types ))
41
43
assert not isinstance (value , excluded_types )
44
+
45
+
46
+ def test_issue_4144_regression ():
47
+ find_any (everything_except (()), lambda t : t is not type )
You can’t perform that action at this time.
0 commit comments