V3 Coverage Strategy

Goal

Maintain full line/branch coverage for v3 behavior while keeping tests readable and representative of user workflows.

Testing split

Common usage paths (user-facing)

  • Prefer doctests in documentation/examples.

  • Cover stable API entry points and common data flows.

  • Keep examples readable and copy/paste friendly.

Edge and failure paths (engineering-facing)

  • Prefer pytest in tests/test_000_detextive.

  • Cover boundary and error behaviors.

  • Use dependency injection surfaces (detector registries, behavior arguments) instead of monkey-patching internals.

Component focus areas

Detection and Inference

  • Detector ordering and fallback behavior.

  • Header/location context handling.

  • Default-vs-error policy behavior with confidence expectations.

Decoding

  • Trial decode sequencing and validator interactions.

  • HTTP Content-Type charset behavior, including non-textual rejection.

  • decode_inform textual MIME guarantees and metadata shape.

Validation

  • Profile behavior for reasonable vs unreasonable text.

  • Confidence-threshold behavior and validation gating.

Coverage workflow

  1. Run hatch --env develop run testers for the combined coverage view.

  2. Use hatch --env develop run coverage report --show-missing to identify exact uncovered lines/branches.

  3. Add/adjust doctests for common user-facing paths.

  4. Add/adjust pytest cases for edge/error branches.

  5. Re-run testers and verify coverage remains at target.