Skip to content

test: add deliberately-broken fixture set + graceful-failure tests (#655) - #762

Merged
jepegit merged 1 commit into
masterfrom
655-bad-file-coverage
Jul 28, 2026
Merged

test: add deliberately-broken fixture set + graceful-failure tests (#655)#762
jepegit merged 1 commit into
masterfrom
655-bad-file-coverage

Conversation

@jepegit

@jepegit jepegit commented Jul 28, 2026

Copy link
Copy Markdown
Owner

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 of custom_data_001.csv + fixed transforms). --verify regenerates twice and asserts byte-identical. Writes LF verbatim; .gitattributes marks testdata/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.py bad_* block; goldens README notes the generator.

Contract pinned (current behavior)

fixture behavior
nan_inf NaN/Inf preserved in raw, no rows dropped (cellpy does not filter at load)
missing_cycle non-contiguous cycle index {1, 3} preserved — no fabricated cycle 2 ✓
truncated tolerated — intact rows survive, partial trailing row parsed with NaNs
missing_column silently omitted → only surfaces as a downstream KeyError

The 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.py5 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

)

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>
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

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.

@jepegit
jepegit enabled auto-merge (squash) July 28, 2026 10:37
@jepegit
jepegit merged commit ddfa7c0 into master Jul 28, 2026
6 checks passed
@jepegit
jepegit deleted the 655-bad-file-coverage branch July 28, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test data gaps: missing fixtures for thorough / batch / loader / error coverage

1 participant