diff --git a/openmc/material.py b/openmc/material.py index 375e1dca1e..1700055268 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -413,6 +413,8 @@ class Material(IDManagerMixin): Z, _, _ = openmc.data.zam(nuclide) except ValueError as e: warnings.warn(str(e)) + except KeyError as e: + warnings.warn(repr(e)) else: # For actinides, have the material be depletable by default if Z >= 89: diff --git a/tests/unit_tests/test_pin.py b/tests/unit_tests/test_pin.py index 42241de5f2..c2a5bc9c0e 100644 --- a/tests/unit_tests/test_pin.py +++ b/tests/unit_tests/test_pin.py @@ -2,7 +2,7 @@ Tests for constructing Pin universes """ -import numpy +import numpy as np import pytest import openmc @@ -98,8 +98,8 @@ def test_subdivide(pin_mats, good_radii, surf_type): # check volumes of new rings radii = get_pin_radii(div0) bounds = [0] + radii[:N] - sqrs = numpy.square(bounds) - assert sqrs[1:] - sqrs[:-1] == pytest.approx(good_radii[0] ** 2 / N) + sqrs = np.square(bounds) + assert np.all(sqrs[1:] - sqrs[:-1] == pytest.approx(good_radii[0] ** 2 / N)) # subdivide non-inner most region new_pin = pin(surfs, pin_mats, {1: N}) @@ -112,6 +112,6 @@ def test_subdivide(pin_mats, good_radii, surf_type): # check volumes of new rings radii = get_pin_radii(new_pin) - sqrs = numpy.square(radii[:N + 1]) - assert sqrs[1:] - sqrs[:-1] == pytest.approx( - (good_radii[1] ** 2 - good_radii[0] ** 2) / N) + sqrs = np.square(radii[:N + 1]) + assert np.all(sqrs[1:] - sqrs[:-1] == pytest.approx( + (good_radii[1] ** 2 - good_radii[0] ** 2) / N))