Skip to content

Instantly share code, notes, and snippets.

@Julian
Created August 6, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Julian/496bd1d964b88378564ddc5eeca06e08 to your computer and use it in GitHub Desktop.
Save Julian/496bd1d964b88378564ddc5eeca06e08 to your computer and use it in GitHub Desktop.
from hypothesis import find, strategies
def check(x):
if x+1 is 1+x:
return False
if x+2 is not 2+x:
return False
return True
print(
find(
strategies.one_of(strategies.integers(), strategies.floats()),
check,
)
)
~/Desktop
⊙ cpython3/bin/python check.py
/Users/jberman/Desktop/cpython3/lib/python3.7/site-packages/hypothesis/core.py:1049: HypothesisDeprecationWarning: `find(s, f)` is deprecated, because it is rarely used but takes ongoing work to maintain as we upgrade other parts of Hypothesis.
since="2019-07-11",
-7
~/Desktop
⊙ pypy3/bin/python check.py
/Users/jberman/Desktop/pypy3/site-packages/hypothesis/core.py:1049: HypothesisDeprecationWarning: `find(s, f)` is deprecated, because it is rarely used but takes ongoing work to maintain as we upgrade other parts of Hypothesis.
since="2019-07-11",
Traceback (most recent call last):
File "test.py", line 15, in <module>
check,
File "/Users/jberman/Desktop/pypy3/site-packages/hypothesis/core.py", line 1121, in find
raise NoSuchExample(get_pretty_function_description(condition))
hypothesis.errors.NoSuchExample: No examples found of condition check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment