Skip to content

FIX: Fix doctest#1091

Open
genedan wants to merge 10 commits into
mainfrom
doctest_test
Open

FIX: Fix doctest#1091
genedan wants to merge 10 commits into
mainfrom
doctest_test

Conversation

@genedan

@genedan genedan commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary of Changes

This is just a test (don't intend to merge) to see if the docstrings get picked up. Should be 252 tests instead of 109.

Related GitHub Issue(s)

1089

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
The WeightedRegression change to sigma_ affects Development/Mack stochastic outputs; new paper-reconciliation tests reduce but do not eliminate regression risk outside tested triangles.

Overview
Fixes documentation testing so CI generates Sphinx autosummary stubs before running Jupyter Book doctests, which lets many more docstring examples (including API stubs) execute in CI.

Docstring and doctest cleanup across Common (pipe, _validate_assumption), IBNR methods, ClarkLDF, and WeightedRegression—mostly expected outputs, testsetup/testoutput formatting, and clearer parameter docs so examples pass reliably.

WeightedRegression (origin-forced OLS path) now documents fit/average explicitly and changes how sigma_ is derived (sqrt(mse) instead of the prior Mack-style scaling). New Mack (1994/1997) hardcoded regression tests anchor sigma_ / IBNR SE behavior; test_sigma1 in development tests was removed.

Test coverage additions exercise Common._validate_assumption, set_backend (including nested Common / ldf_), and has_zeta / cum_zeta_.

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

@github-actions

github-actions Bot commented Jul 8, 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): 15.0% of exported symbols fully typed (191 / 1270)

Known Ambiguous Unknown Total
Project (head) 191 110 969 1270

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

Patch (exported symbols added or changed by this PR): 23.3% fully typed (7 / 30); 1 no longer exported

Known Ambiguous Unknown Total
Patch 7 5 18 30
Patch symbol details
Symbol Status Change
chainladder.core.tests.test_triangle.test_cum_zeta_raises_when_no_zeta ❌ unknown new
chainladder.core.tests.test_triangle.test_cum_zeta_returns_incr_to_cum ❌ unknown new
chainladder.core.tests.test_triangle.test_has_zeta_false ❌ unknown new
chainladder.core.tests.test_triangle.test_has_zeta_true ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_deep_propagates_to_nested_common ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_inplace_mutates_values ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_inplace_updates_array_backend_attr ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_invalid_raises ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_no_array_backend_raises ✅ known new
chainladder.core.tests.test_triangle.test_set_backend_roundtrip ❌ unknown new
chainladder.core.tests.test_triangle.test_set_backend_via_ldf ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_axis2 ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_callable ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_dict ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_scalar ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_sequence ❌ unknown new
chainladder.core.tests.test_triangle.test_validate_assumption_set ❌ unknown new
chainladder.methods.tests.test_mack.test_mack1994_hardcode ❌ unknown new
chainladder.methods.tests.test_mack.test_mack1997_hardcode ❌ unknown new
chainladder.utils.weighted_regression.WeightedRegression.__init__ ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.average ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.axis ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.exponent_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.sigma_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.std_err_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.thru_orig ✅ known changed (was ⚠️ ambiguous)
chainladder.utils.weighted_regression.WeightedRegression.w ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.x ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.xp ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.y ✅ known changed (was ❌ unknown)
chainladder.development.tests.test_development.test_sigma1 no longer exported (was ❌ unknown)

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.76%. Comparing base (c45d10b) to head (b45ab45).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1091      +/-   ##
==========================================
+ Coverage   90.06%   90.76%   +0.69%     
==========================================
  Files          91       91              
  Lines        5287     5287              
  Branches      671      671              
==========================================
+ Hits         4762     4799      +37     
+ Misses        370      346      -24     
+ Partials      155      142      -13     
Flag Coverage Δ
unittests 90.76% <100.00%> (+0.69%) ⬆️

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.

@kennethshsu

Copy link
Copy Markdown
Member

I see 252 tests here, I think this is good.

@henrydingliu

henrydingliu commented Jul 9, 2026

Copy link
Copy Markdown
Member

i'm going to use this branch to fix all the failing doctests

@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 4b4eb71. Configure here.

Comment thread chainladder/methods/tests/test_mack.py Outdated
@henrydingliu

Copy link
Copy Markdown
Member

confirming that mack doctests are now passing

image

* Update common.py

* Update bornferg.py

* Update clark.py

* Update capecod.py

* Update benktander.py

* Update chainladder.py

* Update chainladder.py

* Update bornferg.py

* Update bornferg.py

* Update benktander.py

* Update benktander.py

* Update clark.py

* Update bornferg.py
@henrydingliu henrydingliu mentioned this pull request Jul 10, 2026
1 task
@genedan genedan marked this pull request as ready for review July 11, 2026 01:53
@henrydingliu

Copy link
Copy Markdown
Member

@genedan since i merged in #1096 in here, can you review that PR first?

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.

3 participants