hypothesis-testing

Solid

Property-based testing with Hypothesis for discovering edge cases and validating invariants. Use when implementing comprehensive test coverage, testing complex logic with many inputs, or validating mathematical properties and invariants across input domains. Triggered by: hypothesis, property-based testing, @given, strategies, generative testing.

AI & Automation 2,279 stars 168 forks Updated 3 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 97/100

Stars 20%
100
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Hypothesis Property-Based Testing Hypothesis is a powerful property-based testing library that automatically generates test cases to find edge cases and validate properties of your code. ## Core Concept **Traditional example-based testing:** ```python def test_addition(): assert add(2, 3) == 5 assert add(0, 0) == 0 assert add(-1, 1) == 0 ``` **Property-based testing with Hypothesis:** ```python from hypothesis import given import hypothesis.strategies as st @given(st.integers(), st.integers()) def test_addition_commutative(a, b): """Addition is commutative for ALL integers.""" assert add(a, b) == add(b, a) ``` Hypothesis generates hundreds of test cases automatically, including edge cases you might not think of. ## Installation ```bash # Install hypothesis with pytest integration uv add --dev hypothesis pytest # Optional plugins uv add --dev hypothesis[numpy] # NumPy strategies uv add --dev hypothesis[pandas] # Pandas strategies uv add --dev hypothesis[django] # Django model strategies ``` ## Configuration ### pyproject.toml Configuration ```toml [tool.pytest.ini_options] # Hypothesis settings addopts = [ "--hypothesis-show-statistics", # Show test statistics "--hypothesis-seed=0", # Reproducible tests (optional) ] [tool.hypothesis] # Maximum number of examples to generate max_examples = 200 # Default: 100, CI: 200+ # Deadline for each test case (milliseconds) deadline = 1000 # Default: 200ms, None to disa...

Details

Author
foryourhealth111-pixel
Repository
foryourhealth111-pixel/Vibe-Skills
Created
3 months ago
Last Updated
3 weeks ago
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category