test: reorganize suite into role-based dirs and prune redundant cases - #79
Merged
Merged
Conversation
Reorganize tests/ by the role each test plays, and act on a workflow-
adjudicated audit of droppable test cases (each coverage-removing decision
adversarially verified before acting).
Layout:
- tests/contract/ public-API, property, and cross-cutting invariant tests
- tests/unit/ per-module unit tests
- tests/meta/ packaging / registry / import-hygiene guards
(incl. four reclassified out of tests/regression/)
- tests/regression/ now holds only true bug-guards + the snapshot/gate infra
- tests/data/abbreviation_corpus_en.py corpus data colocated under data/
conftest.py and helpers.py stay at tests/ root so fixtures and the
`tests.helpers` imports keep working across the new subdirs.
Prune / fix:
- drop tests/test_punctuation_replacer.py (asserted only internal sentinels;
every delimiter path is covered behaviorally by segment()-level tests)
- rewrite the processor phase-list tests from exact __name__-tuple pins to
unordered membership + a CJK-phase wiring guard + a behavioral method test
- remove duplicate cases (challenging 119i, the cross-file "Eq. 5" row, four
Armenian rows, Italian/Spanish duplicates)
- drop the brittle Kazakh "unprotected" characterization (already covered by
tests/regression/test_abbr_dot_normalization.py)
- trim the dead-flag German test and correct its docstring
- drop the docstring-substring asserts in test_processor_robustness.py
- reduce test_danish.py to its Danish-divergent rows; regenerate the segment
snapshot (da-only removals, no output changes)
Move tests/test_corpus_compare_segmenters.py to benchmarks/ (it tests the
never-shipped harness) and wire it into CI explicitly since it now sits
outside testpaths=["tests"].
Full suite green (10502 passed, 14 skipped, 113 xfailed); ruff, format,
mypy, and the snapshot diff all clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #78 (base:
feat/v2-abbreviation-engine). Reorganizes the test suite by the role each test plays and acts on a multi-agent–adjudicated audit of droppable cases. Every decision that removed coverage was adversarially verified (default-to-keep) before acting — 5 initially-flagged candidates were kept after the skeptic confirmed they guard real, non-duplicated behavior.Reorganization
tests/root now holds onlyconftest.py/helpers.py(fixtures +tests.helpersimports keep working for all subdirs via the root conftest).tests/contract/tests/unit/tests/meta/regression/)tests/regression/tests/data/abbreviation_corpus_en.pycolocated)The snapshot extractor (
tests/regression/segment_snapshot.py) AST-scanstests/lang/by path —lang/is deliberately left in place so the baseline needs no path-constant change.Pruning / fixes
tests/test_punctuation_replacer.py— asserted only internal sentinels (∯,&…&); every delimiter path is covered behaviorally bysegment()-level tests.__name__-tuple pins → unordered membership + a CJK-phase wiring guard + a behavioral method test.regression/test_abbr_dot_normalization.py).test_processor_robustness.py.test_danish.pyto its Danish-divergent rows; regenerate the segment snapshot (da-only removals, 140 deletions / 0 insertions — no output changes).Move
tests/test_corpus_compare_segmenters.py→benchmarks/(it tests the never-shipped corpus-compare harness) and wired into CI explicitly, since it now sits outsidetestpaths=["tests"].The plan assumed the CJK abbreviation phase could get a
segment()-level plant-a-regression test. Empirically it can't: the base initials logic subsumes it — forcing_apply_cjk_abbreviation_rulesto identity leavessegment()output unchanged for every probed input. It's guarded here at the pipeline level + a behavioral unit test instead. That phase may be dead/redundant defensive code — worth a separate look.Verification
uv run pytest tests/→ 10502 passed, 14 skipped, 113 xfaileduv run pytest benchmarks/test_corpus_compare_segmenters.py→ 3 passedruff check/ruff format --check/mypy→ cleanpython -m tests.regression.segment_snapshot --diff→ no diffs🤖 Generated with Claude Code