test: add deliberately-broken fixture set + graceful-failure tests (#655) - #762
Merged
Conversation
) The #655 audit found error-path coverage was synthetic-only (in-test hooks); no packaged bad files. Add a small, deterministic set under testdata/bad/ (24 KB total), each isolating one defect, plus tests that pin how cellpy currently copes. - dev/make_bad_fixtures.py: pure generator (fixed slice of custom_data_001.csv + fixed transforms), --verify asserts byte-identical; writes LF verbatim, and .gitattributes marks testdata/bad/** binary so the byte-exact files (esp. the truncated one) survive git round-trips. - 5 fixtures: good_small (anchor), nan_inf, missing_cycle, truncated, missing_column. - tests/test_bad_fixtures.py pins the contract: NaN/Inf preserved (not filtered), cycle gap preserved (no fabricated cycle), truncation tolerated, and — the one real gap — a declared-but-absent column is silently omitted (surfaces only as a downstream KeyError). That gap is filed as #761 and its desired behavior asserted as an xfail so the fix flips it to a visible pass. - fdv.py bad_* block; goldens README notes the generator. Verified: make_bad_fixtures.py --verify byte-identical; 5 passed, 1 xfailed. Closes #655. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
What
Final slice of #655 (H2). Error-path coverage was previously synthetic-only (in-test hooks like
bad_steps=); there were no packaged bad files. This adds a small, deterministic bad-file set + tests that pin how cellpy actually copes — and surfaces one genuine robustness gap.Contents
dev/make_bad_fixtures.py— pure, deterministic generator (fixed slice ofcustom_data_001.csv+ fixed transforms).--verifyregenerates twice and asserts byte-identical. Writes LF verbatim;.gitattributesmarkstestdata/bad/**binary so the byte-exact files (especially the truncated one) survive git round-trips.testdata/bad/(24 KB total):custom_good_small(anchor),custom_nan_inf,custom_missing_cycle,custom_truncated,custom_missing_column.tests/test_bad_fixtures.py— pins the observed contract.fdv.pybad_*block; goldens README notes the generator.Contract pinned (current behavior)
{1, 3}preserved — no fabricated cycle 2 ✓KeyErrorThe one real gap → #761
The missing-column case is silent data loss: a declared-but-absent column is dropped without error. Filed as #761; its desired behavior (a clear error/warning naming the column) is asserted as an
xfail(strict=False), so when #761 is fixed the xfail flips to a visible pass.Verification
dev/make_bad_fixtures.py --verify→ 5 fixtures byte-identical across two runs.pytest tests/test_bad_fixtures.py→ 5 passed, 1 xfailed.Closes #655 (Phase 1 complete: slice 3 of 3). Phase-2 items (real GITT, arbin_sql/neware_xlsx exports, messy batch, neware_nda golden, #761 fix) remain for a later dataset-curation pass.
🤖 Generated with Claude Code