GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - HypothesisWorks/hypothesis: The property-based testing library for Python

BranchesTags
Open more actions menu

Latest commit

 

History

18,062 Commits
18,062 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
brand
brand
 
 
guides
guides
 
 
hypothesis
hypothesis
 
 
requirements
requirements
 
 
tooling
tooling
 
 
website
website
 
 
whole_repo_tests
whole_repo_tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.readthedocs.yml
.readthedocs.yml
 
 
AUTHORS.rst
AUTHORS.rst
 
 
CITATION.cff
CITATION.cff
 
 
CONTRIBUTING.rst
CONTRIBUTING.rst
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
build.sh
build.sh
 
 
paper.bib
paper.bib
 
 
paper.md
paper.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

Hypothesis

  • Website
  • Documentation
  • Source code
  • Contributing
  • Community

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.

About

The property-based testing library for Python

hypothesis.works

Topics

fuzzingproperty-based-testingpythontesting

Resources

Readme
License

Contributing

Contributing
Activity
Custom properties

Stars

9.2k stars

Watchers

64 watching

Forks

700 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.