Skip to content

Sparse fixture - #1166

Merged
henrydingliu merged 9 commits into
casact:sparse_testfrom
henrydingliu:sparse_fixture
Jul 29, 2026
Merged

Sparse fixture#1166
henrydingliu merged 9 commits into
casact:sparse_testfrom
henrydingliu:sparse_fixture

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary of Changes

Related GitHub Issue(s)

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

Low Risk
Changes are limited to tests and inline comments; production logic is unchanged except a non-functional comment in Mack summary_.

Overview
Adds unit tests for chainladder.utils.sparse.nanquantile on 1D COO inputs and with keepdims=True, including imports of nanquantile and sparse.all.

Test hygiene only elsewhere: comments in test_grain, test_development, and mack.summary_ clarify default auto_sparse / backend alignment; test_auto_sparse_disabled_returns_self docstring now documents the prism_convert fixture (reduced prism for speed).

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

@henrydingliu
henrydingliu merged commit ac9e1b5 into casact:sparse_test Jul 29, 2026
3 of 9 checks passed
henrydingliu added a commit that referenced this pull request Jul 29, 2026
* fixing fixture

expecting errors

* fixing prism

* trying another approach

* Sparse test fixture (#16)

* fixing fixture

expecting errors

* fixing prism

* trying another approach

* some fixes

* more fixes

* more fixes

* fix for learning

* more learning fix

* restoring test

still fails

* further improving prism_convert

* capecod & mack fixes

* fixing test_utilities and removing sparse.testing

* more fixes

* implementing nanquantile and nanmedian

* Sparse fixture (#1166)

* further improving prism_convert

* capecod & mack fixes

* fixing test_utilities and removing sparse.testing

* more fixes

* implementing nanquantile and nanmedian

* improving comment, adding tests, fixing bugbot

* fixing test

* removing empty check
@github-actions

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.1% of exported symbols fully typed (195 / 1294)

Known Ambiguous Unknown Total
Project (head) 195 110 989 1294

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 315
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): 100.0% fully typed (2 / 2)

Known Ambiguous Unknown Total
Patch 2 0 0 2
Patch symbol details
Symbol Status Change
chainladder.utils.tests.test_sparse.test_1D_nanquantile ✅ known new
chainladder.utils.tests.test_sparse.test_keepdims_nanquantile ✅ known new

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0f76504. Configure here.

None
"""
a = COO(np.array([1,2,3,4]))
assert nanquantile(a,0.5) == 2.5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faulty nanquantile scalar assertion

Low Severity

nanquantile always returns a COO, so assert nanquantile(a, 0.5) == 2.5 checks truthiness of a boolean COO instead of a scalar. That can error or pass regardless of the value. Nearby checks correctly use sparse_all for COO equality.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0f76504. Configure here.

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.

1 participant