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 example — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.

Recent Articles

A Claude Code command for Hypothesis
November 01, 2025
Liam DeVoe, Muhammad Maaz, Zac Hatfield-Dodds, Nicholas Carlini

We wrote a paper using Claude to autonomously write and run Hypothesis tests, and found real bugs in numpy, pandas, and other packages. We've extracted this to a Claude Code command for writing Hypothesis tests, which we're sharing today. We hope you find it …

Hypothesis is now thread-safe
August 07, 2025
Liam DeVoe

TL;DR: as of version 6.136.9, Hypothesis supports running the same test simultaneously from multiple threads.

Hypothesis has historically had the following thread-safety policy:

  • Running tests in multiple processes: fully supported.
  • Running separate tests in multiple threads: not officially supported, but mostly worked.
  • Running the same test in …
The Hypothesis continuous release process
February 27, 2018
alexwlchan

If you watch the Hypothesis changelog, you'll notice the rate of releases sped up dramatically in 2017. We released over a hundred different versions, sometimes multiple times a day.

This is all thanks to our continuous release process. We've completely automated the process of releasing, so every pull request that …