fix zam parsing (#3484)

This commit is contained in:
GuySten 2025-07-03 06:52:39 +03:00 committed by GitHub
parent eb74d497d2
commit 6636b7e32b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -607,7 +607,7 @@ def zam(name):
"""
try:
symbol, A, state = _GNDS_NAME_RE.match(name).groups()
symbol, A, state = _GNDS_NAME_RE.fullmatch(name).groups()
except AttributeError:
raise ValueError(f"'{name}' does not appear to be a nuclide name in "
"GNDS format")

View file

@ -131,7 +131,8 @@ def test_zam():
assert openmc.data.zam('Am242_m10') == (95, 242, 10)
with pytest.raises(ValueError):
openmc.data.zam('garbage')
with pytest.raises(ValueError):
openmc.data.zam('Am242-m1')
def test_half_life():
assert openmc.data.half_life('H2') is None