Skip to content

[FIX] Apply Ruff fix to rtest files. - #1301

Open
genedan wants to merge 1 commit into
gd_ruff_fix_user_guidefrom
gd_ruff_fix_rtest
Open

[FIX] Apply Ruff fix to rtest files.#1301
genedan wants to merge 1 commit into
gd_ruff_fix_user_guidefrom
gd_ruff_fix_rtest

Conversation

@genedan

@genedan genedan commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary of Changes

Stacked PR on top of #1290. Added a missing function dev_corr_p - it was referenced later in the code but never defined.

Related GitHub Issue(s)

#1216

Additional Context for Reviewers

Checklist

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)

Note

Low Risk
Test-only lint and a small missing helper in inactive @pytest.mark.r tests; no production library behavior changes.

Overview
Brings the optional R vs Python rtest_*.py modules in line with Ruff so their per-file ignores can be dropped from pyproject.toml.

Across those files, bare except: becomes except ImportError:, block-comment headers use single # instead of ###, unused imports are removed, and minor formatting/EOF fixes are applied. In rtest_correlation.py, adds the missing dev_corr_p helper (Python-side development_correlation) that downstream correlation tests already called but never defined.

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

@github-actions

github-actions Bot commented Sep 5, 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.4% of exported symbols fully typed (213 / 1382)

Known Ambiguous Unknown Total
Project (head) 213 110 1059 1382

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

Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 1)

Known Ambiguous Unknown Total
Patch 0 0 1 1
Patch symbol details
Symbol Status Change
chainladder.core.tests.rtest_correlation.dev_corr_p ❌ unknown new

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (gd_ruff_fix_user_guide@c56e176). Learn more about missing BASE report.

Files with missing lines Patch % Lines
chainladder/core/tests/rtest_correlation.py 0.00% 3 Missing ⚠️
chainladder/development/tests/rtest_clark.py 0.00% 1 Missing ⚠️
chainladder/development/tests/rtest_development.py 0.00% 1 Missing ⚠️
chainladder/development/tests/rtest_munich.py 0.00% 1 Missing ⚠️
chainladder/methods/tests/rtest_mack.py 0.00% 1 Missing ⚠️
chainladder/tails/tests/rtest_exponential.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##             gd_ruff_fix_user_guide    #1301   +/-   ##
=========================================================
  Coverage                          ?   91.69%           
=========================================================
  Files                             ?       93           
  Lines                             ?     5429           
  Branches                          ?      704           
=========================================================
  Hits                              ?     4978           
  Misses                            ?      326           
  Partials                          ?      125           
Flag Coverage Δ
unittests 91.69% <0.00%> (?)

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.

xp = p.ldf_.get_array_module()
arr = xp.array(df[0])
assert xp.allclose(arr, p.munich_full_triangle_[1, 0, 0, :, :], atol=1e-5) No newline at end of file
assert xp.allclose(arr, p.munich_full_triangle_[1, 0, 0, :, :], atol=1e-5)

@henrydingliu henrydingliu Sep 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ldf_ is always np. sp.allclose also doesn't exist.

xp = p.get_array_module()
p_no_tail = mack_p_no_tail(data, averages[0], est_sigma[0]).sigma_.values
xp.testing.assert_array_equal(p_no_tail, p.values[:, :, :, :-1]) No newline at end of file
xp.testing.assert_array_equal(p_no_tail, p.values[:, :, :, :-1])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ldf_ is always np. sp.testing.assert_array_equal also doesn't exist.

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