From 75d82a7df72dc1a1e40d7983d4537f412fca703f Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 4 Aug 2022 23:43:42 +0100 Subject: [PATCH] reverting to pytest.approx Co-authored-by: Ethan Peterson --- tests/unit_tests/test_material.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/unit_tests/test_material.py b/tests/unit_tests/test_material.py index eadad5006..dbc67fcc2 100644 --- a/tests/unit_tests/test_material.py +++ b/tests/unit_tests/test_material.py @@ -507,14 +507,11 @@ def test_get_activity(): m4 = openmc.Material() m4.add_nuclide("H3", 1) m4.set_density('g/cm3', 1.5) - assert m4.get_activity(normalization='mass') == 355978108155965.94 # [Bq/g] - assert m4.get_activity(normalization='mass', by_nuclide=True) == { - "H3": 355978108155965.94 # [Bq/g] - } - assert m4.get_activity(normalization='volume') == 355978108155965.94*3/2 # [Bq/cc] - assert m4.get_activity(normalization='volume', by_nuclide=True) == { - "H3": 355978108155965.94*3/2 # [Bq/cc] + assert pytest.approx(m4.get_activity(normalization='mass')) == 355978108155965.94 # [Bq/g] + assert pytest.approx(m4.get_activity(normalization='mass', by_nuclide=True)["H3"]) == 355978108155965.94 # [Bq/g] + assert pytest.approx(m4.get_activity(normalization='volume')) == 355978108155965.94*3/2 # [Bq/cc] + assert pytest.approx(m4.get_activity(normalization='volume', by_nuclide=True)["H3"]) == 355978108155965.94*3/2 # [Bq/cc] } # volume is required to calculate total activity m4.volume = 10. - assert m4.get_activity(normalization='total') == 355978108155965.94*3/2*10 # [Bq] + assert pytest.approx(m4.get_activity(normalization='total')) == 355978108155965.94*3/2*10 # [Bq]