refactor(core): extract duplicate drop validation to _validate_contig… - #1286
Conversation
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 1)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1286 +/- ##
==========================================
- Coverage 91.68% 91.67% -0.01%
==========================================
Files 93 93
Lines 5447 5443 -4
Branches 704 702 -2
==========================================
- Hits 4994 4990 -4
Misses 328 328
Partials 125 125
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:
|
|
looks good! do the ruff fixes allow any deletion of per-file ignore in pyproject.toml? |
|
No, neither pandas.py nor test_triangle.py had entries in per-file-ignores. The commit only applied ruff format to satisfy the CI format check on the touched files. |
Summary of Changes
Extracted duplicate contiguous drop validation in
TrianglePandas.drop()into private helper_validate_contiguous_drop(). Added unit test coverage for the helper.Related GitHub Issue(s)
Closes #1267
Additional Context for Reviewers
Pure refactoring that preserves all existing behavior, exception types, and error messages.
Checklist
uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)Note
Low Risk
Behavior-preserving refactor of
Triangle.drop()validation with added unit tests; no API or logic changes beyond deduplication.Overview
Pulls the shared origin and development drop rules out of
TrianglePandas.drop()into a static helper_validate_contiguous_drop, which checks missing labels (KeyError/errors='ignore'), enforces edge-only contiguous drops (ValueErroron interior gaps), and returns the boolean keep mask.drop()on those axes now delegates to the helper; behavior and messages stay the same.Adds
test_validate_contiguous_drop_helperto exercise the helper directly (valid first/last drops, missing labels, interior drop). The rest of the diff is mostly formatting inpandas.pyand test style tweaks.Reviewed by Cursor Bugbot for commit eb84f3a. Bugbot is set up for automated code reviews on this repo. Configure here.