-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
Raphael Constantinis edited this page Jul 23, 2025
·
2 revisions
This page describes testing recommendations for the entropic_measurement library.
- Unit tests: Each function (e.g. shannon_entropy) tested in isolation
- Integration tests: Verifies end-to-end workflows (reading, config, calculation)
- Performance tests: Benchmarking time, memory usage for large data
- Place tests in a
tests/directory - Use
pytest(or unittest)- e.g.,
pytest tests/
- e.g.,
from entropic_measurement import shannon_entropy
def test_shannon_entropy_binary():
data = [0.5, 0.5]
assert shannon_entropy(data) == 1.0
- Include edge cases (zero probability, degenerate distributions, etc.)
- Add compatibility tests for multiple Python versions if needed
- Test with both real and synthetic data samples
- Use simple test datasets for sanity checks
- Use a tool like
coverageto check test coverage (e.g.,coverage run -m pytest) - Automate tests (e.g., with GitHub Actions or another CI)