test: assert reference rows have the expected number of values - #89
test: assert reference rows have the expected number of values#89kilo-code-bot[bot] wants to merge 1 commit into
Conversation
PR Summary
|
test_example truncated each computed row to the reference length (table[method][:len(expected)]), silently ignoring any extra columns a script might start producing. Assert the row lengths match before comparing values, so an added column fails the test instead of being masked. Also assert each script's table is non-empty, so a figure script that produces no rows fails instead of passing silently. Addresses the still-valid parts of CodeRabbit's review comments on the earlier version of these tests.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe example test now rejects empty tables, requires exact row lengths, and compares complete result rows with expected values. ChangesExample validation
Estimated code review effort: 2 (Simple) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
55259ac to
0a2cfac
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #89 +/- ##
=======================================
Coverage 96.37% 96.37%
=======================================
Files 17 17
Lines 496 496
=======================================
Hits 478 478
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Superseded by this PR (the length assertion is folded in). |
What this PR changes
test_exampleintests/test_examples.pytruncated each computed row to the reference length (table[method][:len(expected)]), silently ignoring any extra columns a script might start producing. It now asserts the row length matches the reference before comparing values.Why
CodeRabbit flagged the truncating comparison in the earlier version of this test; that code was rewritten, but the truncation survived in
test_example. This closes the still-valid part: an added column (e.g. a new n_cands/n_voters/condition) now fails the test instead of being masked.Tests
The example tests themselves (run with
pytest -m slow); the length assertion is a no-op for the current scripts since every reference row already matches its output length.Summary by CodeRabbit