--- id: hypothesis version: "6.165.5" license: MPL-2.0 license_treatment: copyleft maintenance: active --- # hypothesis — The property-based testing library for Python License: copyleft · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install hypothesis uv add hypothesis poetry add hypothesis ## Description
# Hypothesis * [Website](https://hypothesis.works/) * [Documentation](https://hypothesis.readthedocs.io/en/latest/) * [Source code](https://github.com/hypothesisWorks/hypothesis/) * [Contributing](https://github.com/HypothesisWorks/hypothesis/blob/master/CONTRIBUTING.rst) * [Community](https://hypothesis.readthedocs.io/en/latest/community.html) 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: ```python 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.... ## AI interpretation — verify before relying Hypothesis is a property-based testing library that generates random test inputs across a specified range to find edge cases and bugs, then shrinks failing cases to their simplest form for easier debugging. Verdict: Hypothesis is a mature, actively maintained property-based testing tool with strong community adoption (top 1000 PyPI). MPL-2.0 copyleft licensing requires attention in proprietary contexts. Zero known vulnerabilities and straightforward installation make it a reliable choice for developers seeking to catch subtle bugs through randomized, shrinkable test cases. [View on SkillFed](https://skillfed.io/packages/hypothesis) · [View on PyPI](https://pypi.org/project/hypothesis/)