[TEST]: Add tests for utility_functions.py#831
Open
genedan wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #831 +/- ##
==========================================
+ Coverage 86.90% 87.19% +0.29%
==========================================
Files 86 86
Lines 4971 4976 +5
Branches 641 642 +1
==========================================
+ Hits 4320 4339 +19
+ Misses 462 452 -10
+ Partials 189 185 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| cl.concat([raa, raa], axis=1) | ||
|
|
||
|
|
||
| def test_maximum(raa: Triangle) -> None: |
Collaborator
There was a problem hiding this comment.
can you remind me what's the desired behavior of max on NaN? leave them alone?
| ) | ||
| assert result == expected | ||
|
|
||
| def test_read_pickle(raa: Triangle, tmp_path: Path) -> None: |
Collaborator
There was a problem hiding this comment.
should we also test read_pickle on estimators?
| obj[col] = xp.nan | ||
| objs[num] = obj | ||
| # Make sure columns are in the same order for all objs to ensure proper indexing. | ||
| if list(objs[num].columns) != all_columns: |
Collaborator
There was a problem hiding this comment.
should we kick out a warning here, since we are creating new all-NaN triangles?
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 tests for cl.concat(), cl.read_pickle(), cl.maximum(), and cl.minimum().
Related GitHub Issue(s)
Partially addresses #830. Will need additional PRs to cover the rest.
Additional Context for Reviewers
There was a bug in cl.concat() that didn't properly re-order each triangle's columns prior to the concat, resulting in incorrect indexing. I added a fix along with some minor type annotation changes and docstring edits.
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Medium risk because it changes
cl.concatbehavior by reordering/aligning columns before concatenation, which could affect downstream assumptions even though it addresses an indexing bug.Overview
Adds new test coverage for
cl.read_pickle,cl.concat(error handling, mismatched columns, axis-1 uniqueness, and optional sorting), andmaximum/minimumbehavior.Fixes
concatto force consistent column order across inputs (including when columns are missing and filled withnan) before concatenating, updates the signature/type hints forobjs, and documents thesortflag.Reviewed by Cursor Bugbot for commit bb864ab. Bugbot is set up for automated code reviews on this repo. Configure here.