mdanalysis
mdanalysis copied to clipboard
Fixes #5170: Improve msd_type parsing
This PR implements enhancement proposed in issue #5170
Summary
EinsteinMSD currently lowercases the msd_type string but does not:
- strip whitespace
- validate the type
- handle mixed-case safely
What This PR Does?
- Add
.strip()before.lower()to handle inputs like " xy ". - Add type validation (raise TypeError when msd_type is not a string).
- Add new tests to cover:
- whitespace (" xy ")
- uppercase/mixed case (" Xz ")
- non-string inputs
All tests pass locally
📚 Documentation preview 📚: https://mdanalysis--5173.org.readthedocs.build/en/5173/
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.72%. Comparing base (bbcef1b) to head (21bfdf8).
Additional details and impacted files
@@ Coverage Diff @@
## develop #5173 +/- ##
========================================
Coverage 92.72% 92.72%
========================================
Files 180 180
Lines 22472 22474 +2
Branches 3188 3189 +1
========================================
+ Hits 20837 20839 +2
Misses 1177 1177
Partials 458 458
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.