326-numpy-unittest

Community

Write bulletproof NumPy tests with confidence.

Authorulf1
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

numpypytest

Components

assets

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: 326-numpy-unittest
Download link: https://github.com/ulf1/trading-regime/archive/main.zip#326-numpy-unittest

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.