tests: replaced deprecated assert_almost_equal in GNM analysis test ref #3743#5329
tests: replaced deprecated assert_almost_equal in GNM analysis test ref #3743#5329MegaCoderNerd wants to merge 2 commits intoMDAnalysis:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the GNM analysis test suite to remove usage of NumPy’s deprecated assert_almost_equal, standardizing on assert_allclose with explicit tolerances, and records the contributor in AUTHORS.
Changes:
- Replaced
assert_almost_equalassertions withassert_allcloseintestsuite/MDAnalysisTests/analysis/test_gnm.py, adding explicitrtol/atolwhere needed. - Removed the deprecated
assert_almost_equalimport and kept a singleassert_allcloseimport. - Added the contributor name to
package/AUTHORS.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| testsuite/MDAnalysisTests/analysis/test_gnm.py | Migrates deprecated NumPy test assertions to assert_allclose with explicit tolerances. |
| package/AUTHORS | Adds contributor to the chronological authors list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, | ||
| -2.263157894736841, -0.24333213169614382 | ||
| ] | ||
| ], |
There was a problem hiding this comment.
There is trailing whitespace after the closing bracket on this line. This can trigger lint failures (e.g., W291) and should be removed.
| ], | |
| ], |
| gnm.results.eigenvalues, | ||
| [3.57984776e-16, 3.53892581e-16], | ||
| rtol=0, | ||
| atol=1e-7 |
There was a problem hiding this comment.
This multi-line call is missing a trailing comma after the last keyword argument. In this repo, files using # fmt: off/on are typically autoformatted; adding the trailing comma will keep formatting consistent and avoids formatter churn.
| atol=1e-7 | |
| atol=1e-7, |
| import numpy as np | ||
| import pytest | ||
| from numpy.testing import assert_almost_equal | ||
| from numpy.testing import assert_allclose |
There was a problem hiding this comment.
PR description still contains the placeholder Fixes # without an issue number. Please either link the intended issue (the title mentions ref #3743) or remove the Fixes # line to avoid confusion/auto-closing the wrong issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5329 +/- ##
===========================================
- Coverage 93.84% 93.83% -0.01%
===========================================
Files 182 182
Lines 22492 22492
Branches 3199 3199
===========================================
- Hits 21107 21106 -1
- Misses 923 924 +1
Partials 462 462 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #
Changes made in this Pull Request:
previous decimal=4 checks now use rtol=0 and atol=1e-4
previous default precision checks now use rtol=0 and atol=1e-7
LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS? (If it is not, add it!)No changelog/docs update needed; this is a test-only maintenance change.
Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.
📚 Documentation preview 📚: https://mdanalysis--5329.org.readthedocs.build/en/5329/