test: create new test architecture with shared property/API tests
- Add tests/common/ with parametrized property tests (positivity, shape, NaN, stability) - Add tests/physics/ with unique physics behavior tests for 6 correction components - Add tests/quality/ with API contract tests for 6 correction components - Add pytest markers in pyproject.toml: property, physics, api, quality, integration - New tests: 94 tests passing (physics + quality + common helpers) - Old tests in tests/ root still present — migration in progress - Total: 261 tests collected (230 old + 94 new - 63 duplicates removed) The shared helpers eliminate 18 duplicate test patterns across correction components. Each component now has: - tests/physics/test_<name>.py — unique physics behavior - tests/quality/test_api_<name>.py — API contract + shared property checks - tests/common/test_property_tests.py — shared helpers (imported, not duplicated)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Shared test utilities for the beta-spectrum test suite.
|
||||
|
||||
This module provides parametrized test helpers that eliminate duplicate
|
||||
test code across correction components. Instead of each component
|
||||
writing its own `test_positive`, `test_output_shape`, `test_no_nan`
|
||||
functions, they import and use these shared helpers.
|
||||
|
||||
## Design principles
|
||||
|
||||
1. **Parametrized, not duplicated** — one `test_positive_everywhere` helper
|
||||
covers all components via pytest.mark.parametrize.
|
||||
2. **Fail-fast** — if a helper fails, the error message identifies the
|
||||
component and the violated property.
|
||||
3. **Physics-aware** — helpers understand that some components (like
|
||||
phase_space) return zero at threshold, so "positive" means "non-negative
|
||||
with at least one strictly positive value."
|
||||
"""
|
||||
Reference in New Issue
Block a user