nw-pbt-python
SolidPython property-based testing with Hypothesis framework, strategies, and pytest integration
Testing & QA 542 stars
57 forks Updated yesterday NOASSERTION
Install
Quality Score: 87/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# PBT Python -- Hypothesis
## Framework Selection
**Hypothesis** is the only serious choice for Python PBT. No competitive alternatives.
- 10+ years mature, very actively maintained
- Used by PyTorch, NumPy, pandas
- Seamless pytest integration (no plugin needed)
## Quick Start
```python
from hypothesis import given, assume, settings, HealthCheck
from hypothesis import strategies as st
@given(st.lists(st.integers()))
def test_sort_idempotent(xs):
assert sorted(sorted(xs)) == sorted(xs)
# Run: pytest test_file.py
```
## Generator (Strategy) Cheat Sheet
### Primitives
```python
st.integers() # any int
st.integers(min_value=0, max_value=99) # bounded
st.floats() # includes NaN, inf
st.floats(allow_nan=False, allow_infinity=False)
st.text() # unicode strings
st.text(min_size=1, max_size=50)
st.binary() # bytes
st.booleans()
st.none()
```
### Collections
```python
st.lists(st.integers())
st.lists(st.integers(), min_size=1, max_size=10)
st.sets(st.integers())
st.frozensets(st.text())
st.dictionaries(st.text(), st.integers())
st.tuples(st.integers(), st.text())
```
### Combinators
```python
st.one_of(st.integers(), st.text()) # union
st.sampled_from([1, 2, 3]) # pick from list
st.just(42) # constant
# Map (transform)
st.integers().map(lambda x: x * 2) # even integers
# Filter (use sparingly)
st.integers().filter(lambda x: ...
Details
- Author
- nWave-ai
- Repository
- nWave-ai/nWave
- Created
- 3 months ago
- Last Updated
- yesterday
- Language
- Python
- License
- NOASSERTION
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Solid
hypothesis-testing
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.
2,279 Updated 3 weeks ago
foryourhealth111-pixel Testing & QA Listed
nw-property-based-testing
Property-based testing strategies, mutation testing, shrinking, and combined PBT+mutation workflow for test quality validation
542 Updated yesterday
nWave-ai Testing & QA Solid
nw-pbt-rust
Rust property-based testing with proptest, quickcheck, and bolero frameworks
542 Updated yesterday
nWave-ai