Add pytest.approx in a few unit tests for robustness

This commit is contained in:
Paul Romano 2021-04-19 14:24:03 -05:00
parent 1e1bfb40f1
commit 8547e7082a
2 changed files with 3 additions and 3 deletions

View file

@ -159,7 +159,7 @@ def test_atoms_material_cell(uo2, water):
tuples = c.atoms.items()
for nuc, atom_num, t in zip(expected_nucs, expected_atoms, tuples):
assert nuc == t[0]
assert atom_num == t[1]
assert atom_num == pytest.approx(t[1])
# Change volume and check if OK
c.volume = 3.0

View file

@ -119,9 +119,9 @@ def test_cell(lib_init):
def test_cell_temperature(lib_init):
cell = openmc.lib.cells[1]
cell.set_temperature(100.0, 0)
assert cell.get_temperature(0) == 100.0
assert cell.get_temperature(0) == pytest.approx(100.0)
cell.set_temperature(200)
assert cell.get_temperature() == 200.0
assert cell.get_temperature() == pytest.approx(200.0)
def test_new_cell(lib_init):