Skip to content

Fix add_transformations broken state after invalid input#5265

Open
harshitgajjela-droid wants to merge 2 commits intoMDAnalysis:developfrom
harshitgajjela-droid:fix-add-transformations-input-validation
Open

Fix add_transformations broken state after invalid input#5265
harshitgajjela-droid wants to merge 2 commits intoMDAnalysis:developfrom
harshitgajjela-droid:fix-add-transformations-input-validation

Conversation

@harshitgajjela-droid
Copy link

@harshitgajjela-droid harshitgajjela-droid commented Mar 1, 2026

Fixes #2558

Changes made in this Pull Request:

  • Added input validation in add_transformations to raise TypeError if any transformation is not callable, preventing broken trajectory state
  • Added test test_add_transformations_rejects_non_callable in testsuite/MDAnalysisTests/coordinates/base.py

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

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

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

Copy link

@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

codecov bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 84.37500% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.15%. Comparing base (900d20b) to head (ae06e95).

Files with missing lines Patch % Lines
package/MDAnalysis/coordinates/base.py 84.37% 6 Missing and 4 partials ⚠️

❗ There is a different number of reports uploaded between BASE (900d20b) and HEAD (ae06e95). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (900d20b) HEAD (ae06e95)
5 2
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5265      +/-   ##
===========================================
- Coverage    93.83%   86.15%   -7.69%     
===========================================
  Files          180      180              
  Lines        22473    22476       +3     
  Branches      3189     3191       +2     
===========================================
- Hits         21088    19364    -1724     
- Misses         923     2658    +1735     
+ Partials       462      454       -8     

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

@harshitgajjela-droid harshitgajjela-droid force-pushed the fix-add-transformations-input-validation branch 2 times, most recently from 102a08c to b21338c Compare March 1, 2026 19:45
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.

Trajectory.add_transformation doesn't fail cleanly

1 participant