Skip to content

Instantly share code, notes, and snippets.

@pschanely
Last active March 8, 2024 02:39
Show Gist options
  • Save pschanely/be86e0757acb6b7e3350b2b893e26324 to your computer and use it in GitHub Desktop.
Save pschanely/be86e0757acb6b7e3350b2b893e26324 to your computer and use it in GitHub Desktop.
% cat example.py
from hypothesis import given, settings
from hypothesis import strategies as st
@settings(backend="crosshair")
@given(st.sets(st.integers()))
def test(d):
assert d != {42, 123}
test()
% python example.py
Traceback (most recent call last):
File "/Users/phillipschanely/proj/hypothesis-crosshair/example.py", line 9, in <module>
test()
File "/Users/phillipschanely/proj/hypothesis-crosshair/example.py", line 5, in test
@given(st.sets(st.integers()))
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 1635, in wrapped_test
raise the_error_hypothesis_found
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 1602, in wrapped_test
state.run_engine()
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 1130, in run_engine
runner.run()
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/engine.py", line 535, in run
self._run()
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/engine.py", line 956, in _run
self.generate_new_examples()
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/engine.py", line 743, in generate_new_examples
self.test_function(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/engine.py", line 316, in test_function
self.__stoppable_test_function(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/engine.py", line 230, in __stoppable_test_function
self._test_function(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 1057, in _execute_once_for_engine
escalate_hypothesis_internal_error()
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 1024, in _execute_once_for_engine
result = self.execute_once(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 947, in execute_once
result = self.test_runner(data, run)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 734, in default_executor
return function(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/core.py", line 858, in run
kw, argslices = context.prep_args_kwargs_from_strategies(
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/control.py", line 157, in prep_args_kwargs_from_strategies
obj = check(self.data.draw(s, observe_as=f"generate:{k}"))
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2140, in draw
return strategy.do_draw(self)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/lazy.py", line 167, in do_draw
return data.draw(self.wrapped_strategy)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2134, in draw
return strategy.do_draw(self)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/lazy.py", line 167, in do_draw
return data.draw(self.wrapped_strategy)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2134, in draw
return strategy.do_draw(self)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py", line 833, in do_draw
x = data.draw(self.mapped_strategy)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2134, in draw
return strategy.do_draw(self)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/collections.py", line 259, in do_draw
value = filtered.do_filtered_draw(data)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py", line 1007, in do_filtered_draw
value = data.draw(self.filtered_strategy)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2134, in draw
return strategy.do_draw(self)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/strategies/_internal/numbers.py", line 85, in do_draw
return data.draw_integer(
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 1837, in draw_integer
node = self._pop_ir_tree_node("integer", kwargs)
File "/Users/phillipschanely/proj/hypothesis-Zac-HD/hypothesis-python/src/hypothesis/internal/conjecture/data.py", line 2053, in _pop_ir_tree_node
assert node.ir_type == ir_type
AssertionError
while generating 'd' from sets(integers())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment