Property-Based Testing with Hypothesis
Find edge cases with round trips, reference results and invariants.
A focused 6-page practical workbook by Thomas Reid, with Python source, three passing property tests, setup instructions, exercises and worked answers.
Build bounded strategies for nested JSON values, check a UTF-8 round trip and test sorting with reference results and invariants. A separate intentionally failing example shows how Hypothesis exposes a delimiter bug; it is excluded from the passing test suite.
Download: one ZIP containing the PDF, source, requirements and README. Tested on Windows with Python 3.13.17, pytest 8.3.5 and Hypothesis 6.131.9.
This is a revised practical edition based on my published Medium article, with replacement runnable examples. It is not a verbatim reprint. Suitable for readers who can run Python and want an introduction to property-based testing.