testing: add idempotence / clean-frame-stays-clean invariant test (#164) - #172
Conversation
…eshCode-Org#164) Adds tests/test_idempotence.py: a parametrized invariant test asserting that several already-clean DataFrames (numeric, boolean, datetime, text dtypes) pass through fd.clean() unchanged with zero data-modifying actions, plus a local sanity check that the guard actually fires when a clean column is mutated. Closes FreshCode-Org#164.
|
Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds parametrized tests for clean numeric, boolean, datetime, and text frames, verifying that ChangesCleaning idempotence tests
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
kevincostner17
left a comment
There was a problem hiding this comment.
Review
Looks good and ready to merge.
- Meets #164: shared clean-frame-stays-clean harness across numeric/boolean/datetime/text, plus a non-vacuous mutation sanity check.
- CI is green (quality-fast, test-matrix 3.9–3.13, TruthBench, Gauntlet).
- Local spot-check of the four factories:
cells_changed == 0and frame equality hold.
Non-blocking nits
- Prefer
return_report=Trueover thereport=Truealias for consistency with docs/tests. not any(action.count…)is redundant withcells_changed == 0(same underlying sum).
Approving.
|
Excellent work on the idempotence tests — clear, thorough, and aligned with our conventions. The round‑trip check and mutation sanity guard are especially valuable. Thanks for raising the bar on test coverage, looking forward to more of your contributions! |
Description
Adds
tests/test_idempotence.py: a parametrized invariant test asserting that already-clean DataFrames (numeric, boolean, datetime, and text dtypes) pass throughfd.clean()unchanged and record zero data-modifying actions (report.cells_changed == 0). Also includes a test reusing the existingalready_cleanconftest fixture, a round-trip idempotence check (fd.clean(fd.clean(df))is a no-op), and a local sanity check confirming the invariant actually fails when a clean column is mutated, so the guard isn't vacuous.Fixes #164
Type of Change
Checklist
mypy) and linter checks (ruff) pass locallyNote: I wrote this against the repo's existing conventions (conftest.py, test_api.py, CONTRIBUTING.md) but could not run pytest/ruff/mypy in the environment I authored this from -- please let CI confirm before merging.
Summary by CodeRabbit