mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

MAINT: Replace deprecated numpy assertions in coordinates/base.py

Open Dreamstick9 opened this issue 3 months ago • 8 comments

Contributes to #3743

Changes made in this Pull Request:

  • Replaced deprecated assert_almost_equal and assert_array_almost_equal with assert_allclose in testsuite/MDAnalysisTests/coordinates/base.py.
  • Converted decimal precision to atol=10**(-decimal) and rtol=0 to maintain original test strictness.
  • Added contributor name to package/AUTHORS.

PR Checklist

  • [x] Issue raised/referenced?
  • [ ] Tests updated/added?
  • [ ] Documentation updated/added?
  • [x] package/CHANGELOG file updated?
  • [x] Is your name in package/AUTHORS?

Documentation preview : https://mdanalysis--5156.org.readthedocs.build/en/5156/

Dreamstick9 avatar Nov 24 '25 19:11 Dreamstick9

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 92.72%. Comparing base (5c11b50) to head (b35276c). :warning: Report is 5 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5156   +/-   ##
========================================
  Coverage    92.72%   92.72%           
========================================
  Files          180      180           
  Lines        22457    22472   +15     
  Branches      3186     3188    +2     
========================================
+ Hits         20823    20837   +14     
  Misses        1177     1177           
- Partials       457      458    +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 24 '25 19:11 codecov[bot]

Hi! The Windows test failed in test_density.py with a MaybeEncodingError (unrelated to my changes). Could you please trigger a re-run?

Dreamstick9 avatar Nov 30 '25 13:11 Dreamstick9

/azp run

IAlibay avatar Nov 30 '25 16:11 IAlibay

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 30 '25 16:11 azure-pipelines[bot]

@IAlibay Hi, if you get some free time please review this PR and if there are any other changes that you would like please let me know!

Dreamstick9 avatar Dec 07 '25 05:12 Dreamstick9

@marinegor Thanks for the review!

I have applied all your suggested commits (reverting ref.prec in those spots and fixing the 0.01 tolerance).

Regarding the other places where I used 1e-3—do you want me to do a bulk revert of all those back to ref.prec as well, or are the remaining ones acceptable as they are?

Dreamstick9 avatar Dec 14 '25 17:12 Dreamstick9

Since the issue you're solving doesn't assume changing test logic at all, I'd suggest you revert the ref.spec wherever it was used.

marinegor avatar Dec 14 '25 18:12 marinegor

@marinegor Done! I've reverted the remaining 19 instances of the hardcoded 1e-3 tolerance back to the dynamic ref.prec (or self.prec where appropriate) throughout the file, as requested. Ready for final review. Thanks for your patience!

Dreamstick9 avatar Dec 14 '25 19:12 Dreamstick9

@marinegor Thanks for the final pass! I've accepted and committed all your latest suggestions and fixed all the remaining logic/precision details.

The code is now exactly as you've requested. I'd appreciate your final approval! Thank you for the detailed review.

Dreamstick9 avatar Dec 15 '25 19:12 Dreamstick9

If they are passing, I'd appreciate your final approval

could you clarify on that? I feel like the CI status is publicly available, and hence don't understand what you mean by that.

marinegor avatar Dec 15 '25 22:12 marinegor

Sorry for the miscommunication from my side. I confirmed all 22 core tests are green, and the only failure is on the Labeler job, I think we're good to go.

Dreamstick9 avatar Dec 16 '25 01:12 Dreamstick9

Thank you for reviewing @marinegor . I assigned the PR to you for merging, I hope that's ok!

orbeckst avatar Dec 17 '25 02:12 orbeckst