reverting to pytest.approx

Co-authored-by: Ethan Peterson <ethan.peterson@mit.edu>
This commit is contained in:
Jonathan Shimwell 2022-08-04 23:43:42 +01:00 committed by GitHub
parent 39eaf9d887
commit 75d82a7df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]