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_informtextual MIME guarantees and metadata shape.
Validation¶
Profile behavior for reasonable vs unreasonable text.
Confidence-threshold behavior and validation gating.
Coverage workflow¶
Run
hatch --env develop run testersfor the combined coverage view.Use
hatch --env develop run coverage report --show-missingto identify exact uncovered lines/branches.Add/adjust doctests for common user-facing paths.
Add/adjust pytest cases for edge/error branches.
Re-run
testersand verify coverage remains at target.