Skip to content

Conversation

@IAyaanHere
Copy link
Contributor

@IAyaanHere IAyaanHere commented Jan 15, 2026

Docs: Fix failing doctests in MDAnalysis.analysis.align

Fixed failing doctests in package/MDAnalysis/analysis/align.py caused by NumPy scalar types and non-deterministic memory addresses.

Details:

  1. NumPy Scalars & Mixed Types:
    Functions like rmsd() and alignto() are now returning np.float64 (or a mixed tuple of np.float64 and float) instead of just plain floats. I updated the docstrings to match the actual output.

    Before (Failing):

    Expected:
        (21.892591663632704, 6.809396586471809)
    Got:
        (np.float64(21.892591663632704), 6.809396586471809)
    
    
  2. Memory Address (RAM) Issue: The AlignTraj example was failing because the object print includes a memory address (e.g., 0x00...), which changes on every run. The standard ellipsis ... wasn't catching it properly on my environment.

Before (Failing):

Expected:
<MDAnalysis.analysis.align.AlignTraj object at ...>
Got:
<MDAnalysis.analysis.align.AlignTraj object at 0x000001D789C0F770>

After: Suppressed the output using _ = ... to make the test deterministic.

Verification: Ran tests locally: pytest --doctest-modules package/MDAnalysis/analysis/align.py Result: 2 passed (All warnings unrelated to changes).

LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: no

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS?
  • LLM/AI disclosure was updated.

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--5207.org.readthedocs.build/en/5207/

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (9cbc8ea) to head (6162231).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5207   +/-   ##
========================================
  Coverage    92.72%   92.72%           
========================================
  Files          180      180           
  Lines        22475    22475           
  Branches      3190     3190           
========================================
  Hits         20841    20841           
  Misses        1177     1177           
  Partials       457      457           

☔ 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.

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.

1 participant