Repolode
HypothesisWorks

HypothesisWorks/hypothesis

A property-based testing library for Python that generates test inputs automatically and shrinks failures to minimal examples.

Stars
9,139
Forks
698
Open issues
53
Last commit
17 hours ago

What is it?

Hypothesis lets you write tests that should hold for every input in a range you describe. Instead of hand-picking examples, you declare strategies for the data, and Hypothesis chooses inputs at random, including edge cases a developer might not think of.

When a test fails, Hypothesis shrinks the failing input to the simplest example that still reproduces the bug, which makes the report easier to debug. The library is installed with pip and can be extended with optional extras.

Key features

  • 01Generates test inputs from declarative strategies such as lists and integers.
  • 02Shrinks failing inputs to the simplest case that still reproduces the bug.
  • 03Installs with pip and offers optional extras.

Use cases

  • Testing that a custom sort or parser behaves correctly across many generated inputs.
  • Finding edge-case bugs that hand-written unit tests tend to miss.
  • Debugging failures by reducing them to minimal reproducible examples.

Quick start

  1. 1

    Install Hypothesis with pip

    pip install hypothesis

In collections

Topics

#testing#property-based-testing#fuzzing#python

FAQ

What is hypothesis?
A property-based testing library for Python that generates test inputs automatically and shrinks failures to minimal examples. Hypothesis lets you write tests that should hold for every input in a range you describe. Instead of hand-picking examples, you declare strategies for the data, and Hypothesis chooses inputs at random, including edge cases a developer might not think of.
Is hypothesis free to use? What license does it have?
hypothesis is open source under the Other license. Check the license terms before using it in commercial products.
Is hypothesis still maintained?
Actively maintained. The last commit to hypothesis was on Nov 6, 2026.
What can I use hypothesis for?
Testing that a custom sort or parser behaves correctly across many generated inputs. Finding edge-case bugs that hand-written unit tests tend to miss. Debugging failures by reducing them to minimal reproducible examples.
How do I install hypothesis?
Install Hypothesis with pip: pip install hypothesis
Where can I get hypothesis?
The source code and installation instructions are on GitHub: https://github.com/HypothesisWorks/hypothesis

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects

Google's continuous fuzzing service for open source projects, running libFuzzer, AFL++ and Honggfuzz with sanitizers to find security bugs.

Security#fuzz-testing#security#vulnerability-detection
12.9K+94 this week3KShellApache-2.0Updated 12 hours ago