TST: Add arithmetic compatibility tests.#1038
Open
genedan wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
==========================================
+ Coverage 89.21% 89.35% +0.14%
==========================================
Files 89 89
Lines 5165 5169 +4
Branches 661 661
==========================================
+ Hits 4608 4619 +11
+ Misses 390 386 -4
+ Partials 167 164 -3
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:
|
Collaborator
|
ah, splendid. i've had an issue with sparse arithmetic forever. the behavior below seems counter-intuitive when adding any two sparse triangles return a sparse triangle. would you consider this to already covered by these new test? clrd = cl.load_sample('clrd').set_backend('sparse')
clrd_gr = clrd.groupby('GRNAME').sum()
print(clrd.array_backend)
print(clrd_gr.array_backend)sparse
numpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Add some tests for uncovered lines in
dunders.py, dealing with arithmetic operations on Triangles with different grain and backends.Related GitHub Issue(s)
Additional Context for Reviewers
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Test-only changes with no production code modifications.
Overview
Adds regression tests in
test_arithmetic.pyfordunders.pyarithmetic behavior that was previously untested.Backend promotion: sparse
Triangle+numpy.ndarray, and numpyTriangle+ sparseCOO, should both yield a sparse backend and matchraa + 1when converted to numpy.Grain guard: adding triangles with mismatched grain (e.g.
raavsqtr) must raiseValueErrorwith the message that both triangles need the same grain.Existing arithmetic tests are unchanged aside from new imports and typing (
TYPE_CHECKING,Trianglefixture annotations).Reviewed by Cursor Bugbot for commit b024736. Bugbot is set up for automated code reviews on this repo. Configure here.