Freedom251 › Property-Based Testing Tools
Hypothesis

What Hypothesis is
Hypothesis is a free Python library for property-based testing. A developer describes behavior that code should meet, and the library generates inputs—including edge cases—to explore whether those properties hold. Strategies define and combine the data a test should use. When Hypothesis finds a failure, it reports an example and tries to simplify it; failing examples are stored in a local test database for replay in later runs. Tests execute as ordinary Python functions inside pytest, unittest, nose, or another framework able to run a Python function. Hypothesis is not itself a test runner. Rule-based state machines can generate sequences of operations for tests of stateful systems and objects. By default, it generates 100 random inputs per test, a count that can be adjusted with max_examples. The project says it works and is regularly tested on Linux, macOS, Windows, and Emscripten, and supports CPython and PyPy 3.10 and later. First-party extras include integrations for specific packages, with Django given as a documented example. The project supports only its most recent version; undocumented behavior may change even in patch releases.
Who it suits
It suits Python developers who want tests to explore generated inputs and edge cases rather than rely only on hand-picked examples. It is especially relevant to people testing properties or stateful behavior within an existing test framework.
What it does well
- Generates inputs including edge cases
- Simplifies failing examples
- Stores failures for replay
- Supports pytest and unittest
- Can generate stateful operation sequences
What to know first
- Not a test runner itself
- Supports only the most recent version
- Undocumented behavior may change in patch releases
Limits
By default, Hypothesis generates 100 random inputs per test, adjustable with max_examples. The project supports only its most recent version; documented APIs are not expected to break except between major version bumps, while undocumented behavior may change in patch releases.
Getting started
- Visit the Hypothesis website.
- Install Hypothesis from PyPI.
- Use it in a Python test function within pytest, unittest, nose, or another compatible framework.
- Describe the properties to check and define input data with strategies.
- Adjust max_examples if you want to change the default of 100 generated inputs per test.
Verdict
Hypothesis adds generated-input property testing to an existing Python test framework, with failure reduction and replay. Users should account for its version policy and the need for a separate test runner.
Questions
What does Hypothesis cost?
Hypothesis is free and has a free plan.
Which programming language does it support?
It is a property-based testing library for Python, supporting CPython and PyPy 3.10 and later.
Does it replace pytest or unittest?
No. Hypothesis runs within a test framework and works with pytest, unittest, nose, or another framework that can run a Python function.
How many inputs does it generate?
The default is 100 random inputs per test. You can control the count with max_examples.
Can it replay a failure?
Yes. Hypothesis saves failing examples in a local test database so it can replay them in later runs.
Which operating systems are supported?
The project says it works and is regularly tested on macOS, Windows, Linux, and Emscripten.
Facts from Hypothesis's own pages
- Community help
- Users can ask questions using the python-hypothesis Stack Overflow tag or join the mailing list for help and discussion. · hypothesis.readthedocs.io, 29 Sept 2026
- Compatibility limit
- The project supports only the most recent Hypothesis version; documented APIs are not expected to break except between major version bumps, while undocumented behavior may break in patch releases. · hypothesis.readthedocs.io, 29 Sept 2026
- Data generation
- Its strategies let users describe and compose the kinds of data their tests should generate. · hypothesis.works, 28 Sept 2026
- Default run count
- By default, Hypothesis generates 100 random inputs per test, and this count can be controlled with the max_examples setting. · hypothesis.readthedocs.io, 29 Sept 2026
- Development model
- The maintainers say new features must be sponsored or implemented by someone else, and the project has no long-term release plan. · hypothesis.readthedocs.io, 29 Sept 2026
- Edge cases
- Hypothesis randomly chooses inputs, including edge cases the user may not have considered. · hypothesis.works, 29 Sept 2026
- Integrations
- First-party extras include integrations for specific packages, and the documentation gives Django as an example installable extra. · hypothesis.readthedocs.io, 29 Sept 2026
- Intended users
- Hypothesis is for people writing software tests who want to describe acceptable behavior and have the computer explore inputs. · hypothesis.works, 28 Sept 2026
- Operating systems
- The project says it is known to work and regularly tested on macOS, Windows, Linux, and Emscripten. · hypothesis.readthedocs.io, 29 Sept 2026
- Python support
- Hypothesis is supported and tested on CPython and PyPy 3.10 and later. · hypothesis.readthedocs.io, 29 Sept 2026
- Release availability
- The project describes publishing new packages to PyPI after changes are merged, usually within half an hour. · hypothesis.works, 28 Sept 2026
- Repeatable failures
- Hypothesis saves failing examples in a local test database so it can replay them when tests run again. · hypothesis.works, 28 Sept 2026
- Simplifies failures
- When Hypothesis finds a bug, it reports the simplest possible failing example. · hypothesis.works, 29 Sept 2026
- Stateful testing
- Rule-based state machines let Hypothesis generate sequences of operations to test stateful systems and objects. · hypothesis.works, 28 Sept 2026
- Test framework support
- Hypothesis works with pytest, unittest, nose, or another framework that can run a Python function. · hypothesis.works, 28 Sept 2026
- Test runner limitation
- Hypothesis is not itself a test runner; it works inside a user's normal testing framework. · hypothesis.works, 28 Sept 2026
- Test runners
- Hypothesis tests can run as regular Python functions and work with pytest or unittest. · hypothesis.readthedocs.io, 29 Sept 2026
- Thread safety
- As of version 6.136.9, Hypothesis supports running the same test simultaneously from multiple threads. · hypothesis.works, 28 Sept 2026
- What it does
- Hypothesis is a property-based testing library for Python that generates inputs within ranges described by the user. · hypothesis.works, 29 Sept 2026
Where Hypothesis stands on Freedom251
- Property-Based Testing Tools#7 of 28