fix(tests): use assert in test_n_periods so failures actually fail#744
Merged
kennethshsu merged 1 commit intocasact:mainfrom May 7, 2026
Merged
Conversation
The test ended with `return xp.all(...)`, which silently discards the boolean result. Pytest 9 also emits PytestReturnNotNoneWarning. Replacing `return` with `assert` makes the test enforce the expected LDFs and clears the warning. Closes casact#743
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #744 +/- ##
=======================================
Coverage 85.94% 85.94%
=======================================
Files 85 85
Lines 4924 4924
Branches 637 637
=======================================
Hits 4232 4232
Misses 491 491
Partials 201 201
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:
|
Collaborator
|
Thanks for taking this on @SaguaroDev. We have a lot of warnings in pytest, so we really appreciate any help on knocking these out. |
genedan
approved these changes
May 7, 2026
Collaborator
|
@SaguaroDev amazing!! Well done on your first PR! Welcome to the group! @HeatherLDavis should be reaching out to you shortly if she hasn't yet, in case you are interested in joining the WG calls (there's a bit more detail on the readme). |
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
chainladder/development/tests/test_development.py::test_n_periodsended withreturn xp.all(...)instead ofassert xp.all(...). Two consequences:Development(n_periods=3, average='volume')were masked.PytestReturnNotNoneWarningfor any test function that returns a non-Nonevalue.This PR replaces the single
returnwithassert. One-line change.Verification
-W error::pytest.PytestReturnNotNoneWarning: the test errors out on the warning.pytest chainladder/development/tests/test_development.py -W error::pytest.PytestReturnNotNoneWarning→35 passed, 1 xfailed, 0 PytestReturnNotNoneWarnings.1.164→9.999) and confirmed the test now fails withAssertionError(it previously would have passed silently).This is purely a pytest hygiene fix and is independent of the pandas 3.0 work in #664 / #729.
Related GitHub Issue(s)
Closes #743
Additional Context for Reviewers
I grepped
^ returnacrosstest_*.pyto confirm this is the only test in the package with this bug; the other 5 matches are all legitimate fixture returns.Note
Low Risk
Low risk: changes a single test to use
assert, making failures visible and eliminating pytest warnings; no production code changes.Overview
Fixes
test_n_periodsinchainladder/development/tests/test_development.pytoassert xp.all(...)instead of returning the boolean result.This ensures regressions in
Development(n_periods=3, average="volume")cause an actual test failure and avoids pytest warnings about non-Nonetest returns.Reviewed by Cursor Bugbot for commit f1fd507. Bugbot is set up for automated code reviews on this repo. Configure here.