diff --git a/hyperspy/tests/utils/test_material.py b/hyperspy/tests/utils/test_material.py index d621228e7d..fe2e00ebf3 100644 --- a/hyperspy/tests/utils/test_material.py +++ b/hyperspy/tests/utils/test_material.py @@ -17,6 +17,7 @@ # along with HyperSpy. If not, see . import numpy as np +import pytest import hyperspy.api as hs from hyperspy.misc.elements import elements_db @@ -77,6 +78,12 @@ def test_density_of_mixture(): np.testing.assert_allclose( density, hs.material.density_of_mixture(wt, elements)[0, 0]) + # Testing whether the correct exception is raised upon unknown density + elements = ("Cu", "Sn", "At") + wt = (87., 12., 1.) + with pytest.raises(ValueError): + hs.material.density_of_mixture(wt,elements) + def test_mac(): np.testing.assert_allclose(