hypothesis-testing

Featured

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 3,831 stars 344 forks Updated 1 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
8 months ago
Last Updated
1 weeks ago
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Featured

nw-pbt-python

Python property-based testing with Hypothesis framework, strategies, and pytest integration

636 Updated today
nWave-ai
AI & Automation Featured

property-based-testing

Property-based testing with fast-check (TypeScript/JavaScript) and Hypothesis (Python). Generate test cases automatically, find edge cases, and test mathematical properties. Use when user mentions property-based testing, fast-check, Hypothesis, generating test data, QuickCheck-style testing, or finding edge cases automatically.

3,831 Updated 1 weeks ago
foryourhealth111-pixel
Testing & QA Listed

property-testing

Property-based tests: fast-check with Vitest in TypeScript, Hypothesis with pytest in Python. Writes new property tests, exposes a property in code that seems to have none, reviews existing property tests for ones that assert nothing, and triages a failed property test into a wrong property, an ambiguous spec or a real bug. Use it when the owner asks for property tests or for inputs the existing tests miss: "write property tests for this parser", "find the edge cases this function misses", "test the invariants", "tests are green but prod breaks on odd input", "model-based test for this state machine or cache", "do these property tests check anything real", "my property test failed, is it a bug or a wrong property". Also use it on your own in test-first work when the function has an inverse, normalizes or sorts, does arithmetic over money or limits, parses data through a schema, or holds state. Not for binary fuzzing (libFuzzer, AFL), mutation testing, benchmarks or end-to-end UI tests.

4 Updated 1 weeks ago
nyxandro