Building the product · Edition No. 55 · 19 Oct 2026

HypothesisWorks/hypothesis

A Python library that generates test inputs and reduces any failure to the smallest example that still fails.

← Building the productRead the whole edition →
Hypothesis: tests that find their own inputs. Generates test data and shrinks every failure.

9.1k stars · MPL-2.0 · v6.170.2 (2026-10-19) · Track this in Scout

A Python library that generates test inputs and reduces any failure to the smallest example that still fails.

▶Repo detailsthe review · specs · pros & cons · install

What it does

You add one decorator to an existing test function and say what kind of data it takes. Hypothesis then builds examples from that description — integers, text, lists, dates, dictionaries, or combinations you define yourself. It runs your test once per example, by default around a hundred times per test. When a test fails, it starts shrinking: it removes list items, lowers numbers and shortens strings until any further simplification makes the test pass again. It also remembers failures between runs in a local database file, so a case that broke yesterday is tried first today. It plugs into pytest and unittest rather than replacing them, and it can also check that a sequence of method calls on an object never reaches a bad state. It does not test a running website or an API over the network, it does not measure how fast your code is, and it is Python only.

Why it matters

Who it suits. Anyone who writes code that parses, converts or validates data and has no colleague to review it. Encoders, date handling, money arithmetic, anything with string input, anything where the awkward case is the one you did not think of. It fits well where a bug is cheap to find and expensive to ship. Skip it if your code mostly calls other services, because the interesting failures there are in the network and not in the inputs.

Verdict. Worth half an hour, and it is the rare testing tool that pays back on the first afternoon. The thing that makes it worth the time is not the random inputs, it is the shrinking: a failure arrives as a two-character string rather than a six-kilobyte blob, so you can read it. The real cost is thinking clearly about what your function actually accepts, which is work, and it is also most of the benefit. Two meters to set honestly: it will slow your test suite down, because a hundred runs take longer than one. Keep it on the tests where inputs vary and leave your plain examples alone. Version 6.170.1 landed on 16 October 2026 and code was pushed on 31 August 2026. For other languages, dubzzz/fast-check does the same job in JavaScript and proptest-rs/proptest in Rust.

Stars9.1k
LicenceMPL-2.0
Latestv6.170.2 (2026-10-19)
Good
  • The shrinking is the feature, and almost nothing else does it as well.
  • Works inside pytest and unittest, so nothing has to be rewritten.
  • Remembers past failures locally and retries them first.
Watch for
  • Test suites get slower. A hundred examples per test is a hundred runs.
  • A test can fail for a reason that is technically correct but of no interest, and tuning that out takes some reading.
  • Python only. Other languages need the alternatives named above.
Similar repositories
Install
python3 -m venv venv
source venv/bin/activate
pip install hypothesis pytest

On Stack Radar: Build & Ship › Testing & Quality › Browser & E2E Testing.

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.