Skip to content

Updated tests to replace deprecated functions with assert_allclose an…#4979

Closed
0Shadow02 wants to merge 4 commits intoMDAnalysis:developfrom
0Shadow02:update-pytest-assertions
Closed

Updated tests to replace deprecated functions with assert_allclose an…#4979
0Shadow02 wants to merge 4 commits intoMDAnalysis:developfrom
0Shadow02:update-pytest-assertions

Conversation

@0Shadow02
Copy link
Copy Markdown

@0Shadow02 0Shadow02 commented Mar 17, 2025

Pull Request Description

Fixes #3743

Changes Made for mdanalysis/testsuite/MDAnalysisTests/analysis/test_base.py:

  • Replaced deprecated assert_almost_equal with assert_allclose.
  • Utilized pytest.approx for single float comparisons.
  • Enhanced test coverage using pytest.mark.parametrize.
  • Verified error handling for ValueError and IndexError.

PR Checklist:

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

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.

250317_17h31m41s_screenshot


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

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.41%. Comparing base (66e7e5c) to head (8693842).
Report is 22 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4979      +/-   ##
===========================================
- Coverage    93.42%   93.41%   -0.02%     
===========================================
  Files          177      189      +12     
  Lines        21859    22925    +1066     
  Branches      3078     3078              
===========================================
+ Hits         20422    21415     +993     
- Misses         986     1059      +73     
  Partials       451      451              

☔ 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
Copy Markdown
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

  1. Please remove the comments that you inserted. We don't need an explanation like a LLM might give us on what was done.
  2. Put back comments that you removed — these comments contain important information.
  3. Format with black so that the linter passes.

Otherwise this looks good.

@orbeckst
Copy link
Copy Markdown
Member

@yuxuanzhuang can you please be PR shepherd? I'll do the review but please keep an eye on the PR and feel free to ping me. Thanks.

@yuxuanzhuang
Copy link
Copy Markdown
Contributor

@yuxuanzhuang can you please be PR shepherd? I'll do the review but please keep an eye on the PR and feel free to ping me. Thanks.

I think #4951 is addressing the same fix...in case I missed anything?

@orbeckst
Copy link
Copy Markdown
Member

Aren’t the two PRs in different files?

@yuxuanzhuang
Copy link
Copy Markdown
Contributor

Aren’t the two PRs in different files?

They both modified testsuite/MDAnalysisTests/analysis/test_base.py

@0Shadow02
Copy link
Copy Markdown
Author

Hi @yuxuanzhuang, I've made the requested changes to the PR by removing unnecessary comments and formatting the code with black. Please let me know if there are any further adjustments needed. Thank you for your help!

Copy link
Copy Markdown
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

@yuxuanzhuang you're right – this PR is addressing the same issue as PR #4951. Because PR #4951 started earlier and is active, we will not continue on this PR unless the other PR stalls and is closed.

Sorry @0Shadow02 , I hadn't realized that you were doing the same work as in PR #4951.

@0Shadow02
Copy link
Copy Markdown
Author

Hi @orbeckst,

Thank you for the clarification regarding the overlap with PR #4951. I understand that since it was started earlier, this PR will not proceed unless the other one stalls.

If there are any updates or if I can assist in any way, please feel free to reach out. I appreciate your support and guidance.

Best regards,

0Shadow02

@orbeckst
Copy link
Copy Markdown
Member

PR #4951 finally got merged so I am closing this PR as a duplicate.

Thank you for doing the work (it looked good) but we have to be fair.

@orbeckst orbeckst closed this Apr 15, 2025
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.

modernize testing code

3 participants