0

I am trying to use Hypothesis to stress test some code. I need a large example, but Hypthesis has some built in mechanism to prevent that. For example:

from hypothesis import strategies as st
st.lists(st.booleans(), min_size=5000).example()

I get an Unsatisfiable exception, but min_size=1000 works.

How can I stop Hypothesis preventing generation of large examples?

I know that large examples are problematic for the intended use of Hypothesis, but I am repurposing it somewhat and I do need a (very) large random example of my data type.

Daniel Mahler
  • 7,653
  • 5
  • 51
  • 90

1 Answers1

2

Internally, Hypothesis works by parsing a buffer of (psudeorandom or heuristically mutated) bytes into your example. This means that we can't just disable some check for too-large examples; you'd need to work with larger buffers than Hypothesis is designed to cope with. This is very likely to cause serious performance issues, and moderately likely to break in mysterious other ways :/

If you're determined to do so despite the maintainers' warnings, grep for BUFFER_SIZE and good luck with your monkeypatching!

Zac Hatfield-Dodds
  • 2,455
  • 6
  • 19