Skip to content

Commit 66bec02

Browse files
authored
fix (laws/pure): compatibility with hypothesis > 6.113.0 (#1956)
Hypothesis is now setting two entries for the Callables strategies, and then it prefers the one using the type origin. While returns lookup for the first set and replaces the strategy, starting with the one without the type origin. This only changes the callable strategy search order to match hypothesis, alternatively we could set both.
1 parent 09ecc31 commit 66bec02

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

returns/contrib/hypothesis/laws.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ def factory(thing) -> st.SearchStrategy:
179179

180180
def _get_callable_type() -> Any:
181181
# Helper to accommodate changes in `hypothesis@6.79.0`
182-
if Callable in types._global_type_lookup: # type: ignore
183-
return Callable
184-
elif Callable.__origin__ in types._global_type_lookup: # type: ignore
182+
if Callable.__origin__ in types._global_type_lookup: # type: ignore
185183
return Callable.__origin__ # type: ignore
184+
elif Callable in types._global_type_lookup: # type: ignore
185+
return Callable
186186
raise RuntimeError('Failed to find Callable type strategy')
187187

188188

0 commit comments

Comments
 (0)