Add test to cover unit conversion path in DMSReader#5180
Add test to cover unit conversion path in DMSReader#5180tani-dubey wants to merge 5 commits intoMDAnalysis:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5180 +/- ##
===========================================
- Coverage 92.72% 92.72% -0.01%
===========================================
Files 180 180
Lines 22472 22475 +3
Branches 3188 3190 +2
===========================================
+ Hits 20838 20840 +2
- Misses 1176 1177 +1
Partials 458 458 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
IAlibay
left a comment
There was a problem hiding this comment.
This test is insufficient, it only flushes the code (and actually doesn't increase coverage for the dimensions path). Checking the size of the array doesn't do much to solve the initial issue.
A proper test here would include actual checks on the numbers to make sure all the results pre and post conversion are as expected. This would include tests for positions, velocities, and dimensions.
|
Thanks for the detailed feedback |
| np.testing.assert_allclose( | ||
| u_conv.atoms.positions, | ||
| u_native.atoms.positions, | ||
| rtol=1e-6, |
There was a problem hiding this comment.
Does the default rtol fails here?
Maybe also worth adding a comment that we expect this to be the same since DMS and MDAnalysis use the same units?
I don't unfortunately, I'm not even sure the current DMS reference file has dimensions, so it's likely the current file isn't testing anything important. |
Summary
Fixes : #3304
This PR adds a small test for
DMSReaderthat exercises the unit-conversion code path whenconvert_units=True.Details
convert_pos_from_nativeby triggering position accessTest verified locally with:
Notes
ts.dimensionsis intentionallyNonefor DMS files, so this test does not attempt to assert or modify box dimensions.📚 Documentation preview 📚: https://mdanalysis--5180.org.readthedocs.build/en/5180/