Skip to content

Fix doctest examples in DCDFile, TRRFile, and XTCFile docstrings - #5577

Open
thebhavye wants to merge 2 commits into
MDAnalysis:developfrom
thebhavye:doctest-lib-formats
Open

thebhavye wants to merge 2 commits into
MDAnalysis:developfrom
thebhavye:doctest-lib-formats

Conversation

@thebhavye

Copy link
Copy Markdown

Fixes #5575

Changes made in this Pull Request:

  • In the DCDFile, TRRFile and XTCFile docstrings, I changed the lines inside the with blocks from >>> to .... The >>> prompts caused the IndentationErrors, which were the 9 doctest failures.
  • Once the prompts were fixed, the examples failed on files that don't exist (foo.dcd, foo.trr). I replaced them with the DCD, TRR and XTC test files from MDAnalysis.tests.datafiles, and added the imports.
  • XTCFile was opening a .trr file, so it now opens the XTC test file.
  • Instead of looping over every frame and printing coordinates, the examples now print the number of atoms (3341 for DCD, 47681 for TRR and XTC), so the expected output is short and stable.

Testing:

  • Ran make doctest SPHINXOPTS="--keep-going" in package/doc/sphinx.
  • All the libdcd doctests (3/3) and all the libmdaxdr doctests (6/6) now pass.
  • The full run still reports 35 failures and 2 setup failures. These are in other files, outside this issue, and their per-file counts are the same as in the original run (44 failures before, 9 of them from these three classes, so 35 remain).
  • No unit tests added, since only docstring examples changed.

LLM / AI generated code disclosure

  • I have read and understood MDAnalysis's AI policy in AI_POLICY.md.

LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes
-AI was used to help me with setting up the environment

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)
  • I have read and understand the current AI Policy
  • 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.

@read-the-docs-community

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.96%. Comparing base (396a4cd) to head (a5a71fd).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5577   +/-   ##
========================================
  Coverage    93.96%   93.96%           
========================================
  Files          184      184           
  Lines        22679    22679           
  Branches      3228     3228           
========================================
  Hits         21310    21310           
  Misses         911      911           
  Partials       458      458           

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

This branch has not been deployed

No deployments
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.

Doctest failures in DCDFile, TRRFile, and XTCFile docstring examples

1 participant