Skip to content

Triangle slicer tests (Part 2)#950

Open
genedan wants to merge 6 commits into
mainfrom
at_iat_virtual
Open

Triangle slicer tests (Part 2)#950
genedan wants to merge 6 commits into
mainfrom
at_iat_virtual

Conversation

@genedan

@genedan genedan commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary of Changes

Follow up to #948 (review that one first). The size of this one should get smaller assuming the previous gets merged in.

Adds type hints and annotations to At, Iat, and VirtualColumns classes. Adds tests to cover missing lines. Cleans up dead code found in #949. Achieves 100% coverage for slicing.py.

Gonna take the next few days off, so I really wanted to finish this up. I'm probably going to be dreaming about slicing triangles tonight...

Related GitHub Issue(s)

#486
#949

Additional Context for Reviewers

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)

Note

Medium Risk
Changes touch core indexing and column assignment on numpy and sparse backends; .at validation is stricter and may reject keys that previously slipped through.

Overview
Adds static typing for Triangle slicing: a BackendArray alias and TriangleProtocol for mixins, plus annotations across TriangleSlicer, .at/.iat, and VirtualColumns. At._check_index now requires all four axes explicitly (no ellipsis), treats full-axis slice(None) as valid only when that axis has size 1, and uses clearer validation instead of dead next branches.

Behavioral cleanups include _to_scalar for sparse .at/.iat assignment from single-cell Triangles, isinstance-based [] slicing/__setitem__, scalar broadcast when adding new columns, and ValueError instead of a bare except for misaligned column concat. Sparse column replace paths are refactored for clarity without changing intent.

Tests expand coverage for .at rules, column/virtual-column assignment, backend conversion, misaligned origins, and sparse .iat with Triangle values—aiming at full coverage of slice.py.

Reviewed by Cursor Bugbot for commit 2df561b. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.17%. Comparing base (b24f209) to head (2df561b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #950      +/-   ##
==========================================
+ Coverage   88.79%   89.17%   +0.37%     
==========================================
  Files          89       89              
  Lines        5060     5089      +29     
  Branches      646      648       +2     
==========================================
+ Hits         4493     4538      +45     
+ Misses        423      414       -9     
+ Partials      144      137       -7     
Flag Coverage Δ
unittests 89.17% <100.00%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants