Repository navigation
test(catalog): add 31 tests for merge-curated-fields and text normalization - #2547
Conversation
…t, papermill/comment detection - TestMergeCuratedFields (13 tests): critical stale-catalog poison prevention, verifies curated git fields (last_validation, last_validator, issue_pr_associee) are preserved from origin/main for unchanged entries - TestNormalizeText (7 tests): accent stripping, code fence removal, apostrophe norm - TestIsPapermillInjected (5 tests): Papermill parameter cell detection - TestIsCommentOnlyCell (6 tests): comment-only code cell detection Total: 166 catalog tests (135 -> 166) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
[NanoClaw] Solid test addition — 32 tests across 4 new test classes covering _merge_curated_fields (12 tests) — thorough The core merge logic is well-exercised: empty/None main catalog, empty entries, blank-field fill, non-empty preservation, mixed fill+keep, missing-key-as-empty, no-match-in-main, multiple entries, non-curated-field isolation, in-place mutation check, and the CURATED_GIT_FIELDS constant assertion. Tests align with the actual implementation at line 633 — the early-return on One minor note: _normalize_text (8 tests) — good, one weak assertion Covers lowercase, accent stripping, curly-to-straight apostrophe, fenced code removal (both single-tag and generic multiline), empty string, and content preservation. All match the implementation at line 264.
_is_papermill_injected (5 tests) — complete For a one-liner (line 321), this is exhaustive: injected tag present, no tags, wrong tags, empty tags list, and no metadata at all. _is_comment_only_cell (7 tests) — strong Covers the key edge cases well: pure comments, code+comment mix, empty source, whitespace-only, mixed comments+blank lines, actual code, and the triple-quoted string case (important since the function checks Minor nits
Overall: clean, well-structured, meaningful assertions. LGTM with the minor note on |
Summary
Add test coverage for 4 previously-untested pure functions in
generate_catalog.py:_merge_curated_fields(13 tests) — CRITICAL: verifies the stale-catalog poison prevention logic (enrich(Lean-14b): 3-pillars showcase — Exercice 4 heading + Pillars.lean source + scaffold interpretation (See #2155) #2376/feat(grothendieck): wire SheafBasics.lean into umbrella import (See #2159) #2383/enrich(RL): add PPO from scratch notebook (See #295, #1454) #2385). Ensures curated git fields (last_validation,last_validator,issue_pr_associee) are preserved fromorigin/mainwhen regenerating catalog on a branch behind main._normalize_text(7 tests) — accent stripping, code fence removal, apostrophe normalization for intro/conclusion detection._is_papermill_injected(5 tests) — Papermill parameter cell detection via injected-parameters tag._is_comment_only_cell(6 tests) — comment-only code cell detection (blank lines, whitespace, pure comments).Test results
Files changed
scripts/tests/test_generate_catalog.py-- +249 lines (4 new test classes)