Skip to content

Commit

Permalink
Update AUTHORS and CHANGELOG for improved error message in AtomGroup.…
Browse files Browse the repository at this point in the history
…unwrap(), rewrite test case
  • Loading branch information
laksh-krishna-sharma committed Jul 27, 2024
1 parent f8493f9 commit a262f2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ Chronological list of authors
- Valerij Talagayev
- Kurt McKee
- Fabian Zills
- Laksh Krishna Sharma



Expand Down
3 changes: 2 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The rules for this file:
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
ljwoods2, aditya292002, pstaerk, PicoCentauri, BFedder,
tyler.je.reddy, SampurnaM, leonwehrhan, kainszs, orionarcher,
yuxuanzhuang, PythonFZ
yuxuanzhuang, PythonFZ, laksh-krishna-sharma

* 2.8.0

Expand Down Expand Up @@ -52,6 +52,7 @@ Fixes
* Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374)

Enhancements
* Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642)
* Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP)
* Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()`
(PR #4531)
Expand Down
7 changes: 5 additions & 2 deletions testsuite/MDAnalysisTests/core/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
import itertools
import re
import numpy as np
from numpy.testing import (
assert_array_equal,
Expand Down Expand Up @@ -1485,17 +1486,19 @@ def test_get_non_topattr(self, universe):
with pytest.raises(AttributeError) as exc:
universe.atoms.jabberwocky
assert 'has no attribute' in str(exc.value)

def test_unwrap_without_bonds(self, universe):
with pytest.raises(NoDataError) as exc:
universe.atoms.unwrap()

expected_message = (
"AtomGroup.unwrap() not available; this AtomGroup lacks defined bonds. "
"To resolve this, you can either:\n"
"1. Guess the bonds at universe creation using `guess_bonds = True`, or\n"
"2. Create a universe using a topology format where bonds are pre-defined."
)
assert str(exc.value) == expected_message
expected_message_pattern = re.escape(expected_message)
assert re.fullmatch(expected_message_pattern, str(exc.value))

def test_get_absent_attr_method(self, universe):
with pytest.raises(NoDataError) as exc:
Expand Down

0 comments on commit a262f2a

Please sign in to comment.