-
Notifications
You must be signed in to change notification settings - Fork 853
Fixes #5170: Improve msd_type parsing #5173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
90a3074
Fixes #5170: Improve msd_type parsing
tani-dubey f720f00
Corrected black error
tani-dubey 21bfdf8
Added Tanisha Dubey to authors
tani-dubey 206766d
Improve msd_type parsing: clearer errors and safer string handling
tani-dubey 8a9b472
Update tests for msd_type validation
tani-dubey a746e0c
Black: reformatted files
tani-dubey 2c69667
Apply Black formatting
tani-dubey ced5ece
black-formatting-issue
tani-dubey 45a4658
Improve msd_type error handling with minimal changes
tani-dubey 5f62866
Improve msd_type error handling
tani-dubey b2bec49
Improve msd_type error handling
tani-dubey fad64a3
minor fix
tani-dubey 83594a4
improved test_msd.py
tani-dubey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,20 @@ def test_msdtype_error(self, u, SELECTION, msdtype): | |
| with pytest.raises(ValueError, match=errmsg): | ||
| m = MSD(u, SELECTION, msd_type=msdtype) | ||
|
|
||
| def test_msd_type_whitespace(self, u, SELECTION): | ||
| m = MSD(u, SELECTION, msd_type=" xy ", fft=False) | ||
| assert m.dim_fac == 2 | ||
| assert m._dim == [0, 1] | ||
|
|
||
| def test_msd_type_uppercase(self, u, SELECTION): | ||
| m = MSD(u, SELECTION, msd_type=" Xz ", fft=False) | ||
| assert m.dim_fac == 2 | ||
| assert m._dim == [0, 2] | ||
|
|
||
| def test_msd_type_nonstring(self, u, SELECTION): | ||
| with pytest.raises(TypeError): | ||
| MSD(u, SELECTION, msd_type=123, fft=False) | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added tests covering
|
||
| @pytest.mark.parametrize( | ||
| "dim, dim_factor", | ||
| [ | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added these lines in
msd.py, they do -msd_typeis a string to avoid unexpected AttributeErrors..strip().lower()to handle inputs with leading/trailing whitespace(e.g. " xy ", " Xz "), while preserving existing case-insensitive behavior.