What problem does it solve?
It prevents fragile or incorrect unit tests for NumPy code by enforcing correct comparison semantics, numerically stable tolerance handling, and reliable checks for shapes, dtypes, and mutation side effects.
Core Features & Use Cases
- Correct NumPy Assertions: Use
numpy.testing array-aware assertions instead of brittle == comparisons to avoid truth-value errors and hidden mismatches.
- Precision-Safe Validation: Require explicit
rtol and atol for floating-point results, including guidance for stable comparisons of probabilities and mathematical outputs.
- Robust Invariant and Edge-Case Coverage: Validate shapes/dtypes, test mathematically meaningful invariants (e.g., sums-to-1), and cover boundary and numerical stability cases such as NaN/Inf and overflow.
- Side-Effect Guardrails: Detect unintended input mutation and verify consistent behavior on non-contiguous/strided views.
Quick Start
Use the skill when you are writing or reviewing a pytest/unittest for any NumPy function, especially one that compares array values, checks shapes/dtypes, or must be tolerant of floating-point precision differences.