Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up pow tests #292

Merged
merged 5 commits into from
Mar 14, 2025
Merged

Clean up pow tests #292

merged 5 commits into from
Mar 14, 2025

Conversation

jagerber48
Copy link
Contributor

@jagerber48 jagerber48 commented Mar 12, 2025

  • Closes Clean up power functions tests #291
  • Executed pre-commit run --all-files with no errors
  • The change is fully covered by automated unit tests
  • Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

Summary of goals:

  • Changes all power tests to use pytest.mark.parametrize. Hopefully this makes the tests more readable.
  • Combines the tests for pow and umath_core.pow in a test_power.py module to get some code re-use and to combine similar tests rather than spread them across modules
  • Remove pow test code from helpers.py module.

Sorry, something went wrong.

Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.71%. Comparing base (19865cc) to head (0b180c9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #292      +/-   ##
==========================================
+ Coverage   96.55%   96.71%   +0.15%     
==========================================
  Files          17       18       +1     
  Lines        1946     1886      -60     
==========================================
- Hits         1879     1824      -55     
+ Misses         67       62       -5     
Flag Coverage Δ
macos-latest-3.10 95.12% <100.00%> (+0.10%) ⬆️
macos-latest-3.11 95.12% <100.00%> (+0.10%) ⬆️
macos-latest-3.12 95.12% <100.00%> (+0.10%) ⬆️
macos-latest-3.8 95.11% <100.00%> (+0.10%) ⬆️
macos-latest-3.9 95.11% <100.00%> (+0.10%) ⬆️
no-numpy 74.60% <100.00%> (-0.53%) ⬇️
ubuntu-latest-3.10 95.12% <100.00%> (+0.10%) ⬆️
ubuntu-latest-3.11 95.12% <100.00%> (+0.10%) ⬆️
ubuntu-latest-3.12 95.12% <100.00%> (+0.10%) ⬆️
ubuntu-latest-3.8 95.11% <100.00%> (+0.10%) ⬆️
ubuntu-latest-3.9 95.11% <100.00%> (+0.10%) ⬆️
windows-latest-3.10 95.12% <100.00%> (+0.10%) ⬆️
windows-latest-3.11 95.12% <100.00%> (+0.10%) ⬆️
windows-latest-3.12 95.12% <100.00%> (+0.10%) ⬆️
windows-latest-3.8 95.11% <100.00%> (+0.10%) ⬆️
windows-latest-3.9 95.11% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Copy link

codspeed-hq bot commented Mar 12, 2025

CodSpeed Performance Report

Merging #292 will not alter performance

Comparing jagerber48:pow_tests (0b180c9) with master (19865cc)

Summary

✅ 5 untouched benchmarks

@newville
Copy link
Member

@jagerber48 Thanks - this looks like an improvement in readability to me! I do worry a bit about a test with
integer = ufloat(-3, 0)

It looks like that is only used to test that using that as an exponent yields a stderr of NaN. That's OK.
I would also be OK with deliberately not testing that: the value ufloat(3, 0) makes no sense, so we should feel obligated to promise a sensible result when using it.

+1 on merging.

@newville newville self-requested a review March 12, 2025 18:50
Copy link
Member

@newville newville left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@jagerber48
Copy link
Contributor Author

I'll double check that all cases are copied over correctly for now and then merge it in.

I would also be OK with deliberately not testing that: the value ufloat(3, 0) makes no sense, so we should feel obligated to promise a sensible result when using it.

Definitely interested in this idea since it's tests like these that have been giving me a lot of trouble on #262 and caused to me raise #283. We can discuss elsewhere. I'll keep this PR as a simple 1:1 test refactor.

@jagerber48 jagerber48 merged commit b7be2e7 into lmfit:master Mar 14, 2025
22 checks passed
@jagerber48 jagerber48 deleted the pow_tests branch March 14, 2025 03:55
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.

Clean up power functions tests
2 participants