<div align="center">
<img src="https://raw.githubusercontent.com/HypothesisWorks/hypothesis/master/brand/dragonfly-rainbow.svg" width="300">
</div>
# 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 example — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.
For instance,
```python
def my_sort(ls):
return sorted(set(ls))
```
fails with the simplest possible failing example:
```
Falsifying example: test_matches_builtin(ls=[0, 0])
```
### Installation
To install Hypothesis:
```
pip install hypothesis
```
There are also [optional extras available](https://hypothesis.readthedocs.io/en/latest/extras.html).
Raw data
{
"_id": null,
"home_page": null,
"name": "hypothesis",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "python, testing, fuzzing, property-based-testing",
"author": null,
"author_email": "\"David R. MacIver and Zac Hatfield-Dodds\" <david@drmaciver.com>",
"download_url": "https://files.pythonhosted.org/packages/39/16/97fa8ac54f46214aafe688461b5e42513763251d6aaf03895c580fddbb72/hypothesis-6.130.12.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <img src=\"https://raw.githubusercontent.com/HypothesisWorks/hypothesis/master/brand/dragonfly-rainbow.svg\" width=\"300\">\n</div>\n\n# Hypothesis\n\n* [Website](https://hypothesis.works/)\n* [Documentation](https://hypothesis.readthedocs.io/en/latest/)\n* [Source code](https://github.com/hypothesisWorks/hypothesis/)\n* [Contributing](https://github.com/HypothesisWorks/hypothesis/blob/master/CONTRIBUTING.rst)\n* [Community](https://hypothesis.readthedocs.io/en/latest/community.html)\n\nHypothesis 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:\n\n```python\nfrom hypothesis import given, strategies as st\n\n\n@given(st.lists(st.integers()))\ndef test_matches_builtin(ls):\n assert sorted(ls) == my_sort(ls)\n```\n\nThis 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 \u2014 it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.\n\nFor instance,\n\n```python\ndef my_sort(ls):\n return sorted(set(ls))\n```\n\nfails with the simplest possible failing example:\n\n```\nFalsifying example: test_matches_builtin(ls=[0, 0])\n```\n\n### Installation\n\nTo install Hypothesis:\n\n```\npip install hypothesis\n```\n\nThere are also [optional extras available](https://hypothesis.readthedocs.io/en/latest/extras.html).\n",
"bugtrack_url": null,
"license": null,
"summary": "A library for property-based testing",
"version": "6.130.12",
"project_urls": {
"changelog": "https://hypothesis.readthedocs.io/en/latest/changelog.html",
"documentation": "https://hypothesis.readthedocs.io",
"homepage": "https://hypothesis.works",
"issues": "https://github.com/HypothesisWorks/hypothesis/issues",
"source": "https://github.com/HypothesisWorks/hypothesis"
},
"split_keywords": [
"python",
" testing",
" fuzzing",
" property-based-testing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "25514da70347824b0b415b4016fe6a7318a9beafb760401980ce8da103489c70",
"md5": "b71f1d78b2cd5caf8d0c4ae885af84a7",
"sha256": "287d4c815868bc1a75c649cc0791556ab48aedb9a7dfa7fb9d3af4bd3f4c1c3d"
},
"downloads": -1,
"filename": "hypothesis-6.130.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b71f1d78b2cd5caf8d0c4ae885af84a7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 495408,
"upload_time": "2025-04-09T03:57:17",
"upload_time_iso_8601": "2025-04-09T03:57:17.151662Z",
"url": "https://files.pythonhosted.org/packages/25/51/4da70347824b0b415b4016fe6a7318a9beafb760401980ce8da103489c70/hypothesis-6.130.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "391697fa8ac54f46214aafe688461b5e42513763251d6aaf03895c580fddbb72",
"md5": "c5a36c47887762be93852fd0ba928dbe",
"sha256": "db4a0cfab0f903d3500e9808b15d2a8a66d822258058bc53011b1216b4b8ec1d"
},
"downloads": -1,
"filename": "hypothesis-6.130.12.tar.gz",
"has_sig": false,
"md5_digest": "c5a36c47887762be93852fd0ba928dbe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 430356,
"upload_time": "2025-04-09T03:57:21",
"upload_time_iso_8601": "2025-04-09T03:57:21.014164Z",
"url": "https://files.pythonhosted.org/packages/39/16/97fa8ac54f46214aafe688461b5e42513763251d6aaf03895c580fddbb72/hypothesis-6.130.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-04-09 03:57:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HypothesisWorks",
"github_project": "hypothesis",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hypothesis"
}