Hypothesis
hypothesis.works
- Free plan
- Windows
- macOS
- Linux
What Hypothesis is
Hypothesis is a free Python library for property-based testing: you describe behavior your code should satisfy, and it generates inputs to probe that behavior, including edge cases you may not have anticipated. Strategies let you define and combine the data types tests should use. If a test fails, Hypothesis reports an example and tries to reduce it to a simpler case; it saves failing examples in a local test database so they can be replayed in later runs. Tests run as regular Python functions within pytest, unittest, nose, or another framework that can run a Python function. Hypothesis is not a test runner itself. By default, it generates 100 inputs per test, a count you can adjust with max_examples. Rule-based state machines can generate operation sequences for testing stateful systems and objects. The project supports CPython and PyPy 3.10 and later, and says it regularly tests on Linux, macOS, Windows, and Emscripten.
Who it suits
Hypothesis is for Python developers who want to state acceptable behavior and have generated inputs explore it. It fits teams already using a Python test framework rather than looking for a standalone test runner.
Good to know, and what to watch
- Generates inputs including edge cases
- Attempts to simplify failing examples
- Stores failures for replay in later runs
- Supports stateful testing with rule-based state machines
- Works with pytest and unittest
- It is not a test runner
- Supports Python only
- Only the most recent version is supported
The verdict
Hypothesis adds generated input exploration to an existing Python testing setup, with failure shrinking and replay to help investigate bugs. Its framework dependency and Python-only scope are important fit considerations.
What the maker publishes
- Community help
- Users can ask questions using the python-hypothesis Stack Overflow tag or join the mailing list for help and discussion. source
- 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. source
- Data generation
- Its strategies let users describe and compose the kinds of data their tests should generate. source
- Default run count
- By default, Hypothesis generates 100 random inputs per test, and this count can be controlled with the max_examples setting. source
- Development model
- The maintainers say new features must be sponsored or implemented by someone else, and the project has no long-term release plan. source
- Edge cases
- Hypothesis randomly chooses inputs, including edge cases the user may not have considered. source
- Integrations
- First-party extras include integrations for specific packages, and the documentation gives Django as an example installable extra. source
- Intended users
- Hypothesis is for people writing software tests who want to describe acceptable behavior and have the computer explore inputs. source
- Operating systems
- The project says it is known to work and regularly tested on macOS, Windows, Linux, and Emscripten. source
- Python support
- Hypothesis is supported and tested on CPython and PyPy 3.10 and later. source
- Release availability
- The project describes publishing new packages to PyPI after changes are merged, usually within half an hour. source
- Repeatable failures
- Hypothesis saves failing examples in a local test database so it can replay them when tests run again. source
- Simplifies failures
- When Hypothesis finds a bug, it reports a failing example and tries to simplify it. source
- Simplifies failures
- When Hypothesis finds a bug, it reports the simplest possible failing example. source
- Stateful testing
- Rule-based state machines let Hypothesis generate sequences of operations to test stateful systems and objects. source
- Test framework support
- Hypothesis works with pytest, unittest, nose, or another framework that can run a Python function. source
- Test runner limitation
- Hypothesis is not itself a test runner; it works inside a user's normal testing framework. source
- Test runners
- Hypothesis tests can run as regular Python functions and work with pytest or unittest. source
- Thread safety
- As of version 6.136.9, Hypothesis supports running the same test simultaneously from multiple threads. source
- What it does
- Hypothesis is a property-based testing library for Python that generates inputs, including edge cases, to test properties you describe. source
- What it does
- Hypothesis is a property-based testing library for Python that generates inputs within ranges described by the user. source
Checked against the maker's pages on 29 Sept 2026.