Skip to content

Commit

Permalink
catch extra warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmyhill committed Mar 24, 2024
1 parent 5b882a3 commit 340dd4f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test_averaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,23 @@ def test_non_present_non_rigid_phase(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
rho, v_p, v_s, v_phi, K, G = rock.evaluate(
["rho", "v_p", "v_s", "v_phi", "K_S", "G"], [10.0e9], [300.0]
["rho", "v_p", "v_s", "v_phi", "K_S", "G"], 10.0e9, 300.0
)
assert len(w) == 1 # we expect one error to be thrown when p_nonrigid = 0
self.assertFloatEqual(150.901, G[0] / 1.0e9)
assert len(w) == 2 # we expect two errors to be thrown when p_nonrigid = 0
self.assertFloatEqual(150.901, G / 1.0e9)

def test_present_non_rigid_phase(self):
rock = burnman.Composite([mypericlase(), my_nonrigid_mineral()], [0.5, 0.5])
rock.set_averaging_scheme(avg.Reuss())
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
rho, v_p, v_s, v_phi, K, G = rock.evaluate(
["rho", "v_p", "v_s", "v_phi", "K_S", "G"], [10.0e9], [300.0]
["rho", "v_p", "v_s", "v_phi", "K_S", "G"], 10.0e9, 300.0
)
assert len(w) == 2 # we expect two errors to be thrown when p_nonrigid != 0
self.assertFloatEqual(0.0, G[0] / 1.0e9)
assert (
len(w) == 4
) # we expect four errors to be thrown when p_nonrigid != 0
self.assertFloatEqual(0.0, G / 1.0e9)


class Voigt(BurnManTest):
Expand Down

0 comments on commit 340dd4f

Please sign in to comment.