Skip to content

TEST: Add tests for base.py#1083

Merged
genedan merged 1 commit into
mainfrom
base_tests
Jul 2, 2026
Merged

TEST: Add tests for base.py#1083
genedan merged 1 commit into
mainfrom
base_tests

Conversation

@genedan

@genedan genedan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary of Changes

Addresses uncovered lines in base.py. I left out tests for anything dealing with dask or cupy.

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 almost entirely tests plus minor type hints and a dependency lock constraint; no production logic changes beyond annotations.

Overview
Adds pytest coverage for TriangleBase behaviors that were previously untested (dask/cupy paths excluded per PR notes).

New tests lock in input sanitization (rows with development before origin trigger a warning and are dropped), _auto_sparse() (no-op when AUTO_SPARSE is off; numpy→sparse when size/density thresholds are met), subtriangles, NumPy __array__ / __array_function__ dispatch (including TypeError for unhandled or mixed types), and DataFrame interchange construction via a Polars frame.

base.py only gains typing polish: _auto_sparse is annotated to return Triangle, and a TYPE_CHECKING import for Triangle.

uv.lock caps pandas at <=3.0.3 alongside the existing >=2.3.3 lower bound.

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

@github-actions

github-actions Bot commented Jul 1, 2026

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): 14.7% of exported symbols fully typed (184 / 1252)

Known Ambiguous Unknown Total
Project (head) 184 106 962 1252

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: 313
  • Functions without default param: 0
  • Classes without docstring: 10

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

Known Ambiguous Unknown Total
Patch 2 0 6 8
Patch symbol details
Symbol Status Change
chainladder.core.tests.test_triangle.test_array_dunder ❌ unknown new
chainladder.core.tests.test_triangle.test_array_function_mixed_types_raises ❌ unknown new
chainladder.core.tests.test_triangle.test_array_function_unhandled_raises ❌ unknown new
chainladder.core.tests.test_triangle.test_auto_sparse_converts_numpy_to_sparse ❌ unknown new
chainladder.core.tests.test_triangle.test_auto_sparse_disabled_returns_self ❌ unknown new
chainladder.core.tests.test_triangle.test_development_before_origin_warns_and_drops ✅ known new
chainladder.core.tests.test_triangle.test_subtriangles ❌ unknown new
chainladder.core.tests.test_triangle.test_triangle_from_dataframe_interchange_protocol ✅ known new

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (7d512f1) to head (8651777).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1083      +/-   ##
==========================================
+ Coverage   89.74%   90.06%   +0.32%     
==========================================
  Files          91       91              
  Lines        5287     5287              
  Branches      671      671              
==========================================
+ Hits         4745     4762      +17     
+ Misses        381      370      -11     
+ Partials      161      155       -6     
Flag Coverage Δ
unittests 90.06% <100.00%> (+0.32%) ⬆️

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.

@genedan genedan merged commit 55f9524 into main Jul 2, 2026
18 checks passed
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