MCPcopy Create free account
hub / github.com/HypothesisWorks/hypothesis

github.com/HypothesisWorks/hypothesis

Chat with this repo
repository ↗ · DeepWiki ↗ · release v6.170.30 ↗ · + Follow · compare 57 versions

The property-based testing library for Python

7,792 symbols 31,884 edges 472 files 766 documented · 10% ● updated today★ 9,39140 open issues

Browse by type

⨍ Functions 6,873◇ Types & classes 774↳ Endpoints 145
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Hypothesis

Hypothesis is the property-based testing library for Python. With Hypothesis, you write tests which should pass for all inputs in whatever range you describe, and let Hypothesis randomly choose which of those inputs to check - including edge cases you might not have thought about. For example:

from hypothesis import given, strategies as st


@given(st.lists(st.integers()))
def test_matches_builtin(ls):
    assert sorted(ls) == my_sort(ls)

This randomized testing can catch bugs and edge cases that you didn't think of and wouldn't have found. In addition, when Hypothesis does find a bug, it doesn't just report any failing test case — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.

For instance,

def my_sort(ls):
    return sorted(set(ls))

fails with the simplest possible failing test case:

Failing test case: test_matches_builtin(ls=[0, 0])

Installation

To install Hypothesis:

pip install hypothesis

There are also optional extras available.

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 5,051
Method 1,822
Class 774
Route 145

Languages

Python100%
Rust1%
TypeScript1%

Modules by API surface

hypothesis/src/hypothesis/internal/conjecture/data.py120 symbols
hypothesis/src/hypothesis/database.py96 symbols
hypothesis/src/hypothesis/strategies/_internal/core.py94 symbols
hypothesis/src/hypothesis/strategies/_internal/strategies.py84 symbols
hypothesis/src/hypothesis/stateful.py74 symbols
hypothesis/src/hypothesis/internal/conjecture/shrinker.py69 symbols
hypothesis/src/hypothesis/internal/conjecture/engine.py63 symbols
hypothesis/src/hypothesis/strategies/_internal/types.py56 symbols
hypothesis/src/hypothesis/strategies/_internal/datetime.py55 symbols
hypothesis/src/hypothesis/_settings.py55 symbols
hypothesis/src/hypothesis/core.py52 symbols
tooling/src/hypothesistooling/__main__.py51 symbols

For agents

$ claude mcp add --transport http codehub https://codehub.bot/mcp

One hosted endpoint, no key: your agent can search, read and trace HypothesisWorks/hypothesis and every other graph here. Cursor, Windsurf and other clients →

⬇ download graph artifact

Ask about this repo answers extend the page