Tired of writing tests? Hypothesis has you covered!
def test():
assert False
test... failed
Traceback (most recent call last):
File "", line 2, in test
AssertionError
It's an interactive demo for
the Hypothesis Ghostwriter, a Python tool which helps you to get started with
property-based testing. Thanks to Pyodide, we can run Python
client-side to both generate and execute tests - and even
pip install
missing packages! If you're not sure how to get
started, try the gzip.compress
example and replacing
data=st.nothing()
with data=st.binary()
to
generate bytestrings.
Want to install Hypothesis locally?
pip install "hypothesis[cli]"
and you'll get the Python
library and a hypothesis write
command which can do all this
and more. If you're already using Hypothesis, check out
HypoFuzz: it's a world-class fuzzing
workflow for your test suite.