Skip to content

Commit

Permalink
move variables into a tuple and compare with the error message list
Browse files Browse the repository at this point in the history
  • Loading branch information
12Chao committed Jul 16, 2020
1 parent 890048c commit b3f2d32
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions interfaces/cython/cantera/test/test_kinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,30 +405,22 @@ def test_modify_thermo(self):
# Rate should be the same if reaction does not involve OH
self.assertAlmostEqual(w2[i] / w1[i], 1.0)
def test_pdep_err(self):
err_msg1 = "Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'"
err_msg2 = "at P = 32018.699999999983 , T = 500.0"
err_msg3 = "Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'"
err_msg4 = "at P = 32018.699999999983 , T = 1000.0"
err_msg5 = "Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'"
err_msg6 = "at P = 101324.99999999999 , T = 500.0"
err_msg7 = "Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'"
err_msg8 = "at P = 101324.99999999999 , T = 1000.0"
err_msg9 = "Invalid rate coefficient for reaction 'CH2CHOO <=> CH3 + CO2'"
err_msg10 = "at P = 10132499.999999985 , T = 500.0"
err_msg = ("Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'",
"at P = 32018.699999999983 , T = 500.0",
"Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'",
"at P = 32018.699999999983 , T = 1000.0",
"Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'",
"at P = 101324.99999999999 , T = 500.0",
"Invalid rate coefficient for reaction 'CH2CHOO <=> CH3O + CO'",
"at P = 101324.99999999999 , T = 1000.0",
"Invalid rate coefficient for reaction 'CH2CHOO <=> CH3 + CO2'",
"at P = 10132499.999999985 , T = 500.0")
try:
ct.Solution('pdep_err_test.yaml')
except ct.CanteraError as e:
err_msg_list = str(e).split('\n')
self.assertIn(err_msg1, err_msg_list)
self.assertIn(err_msg2, err_msg_list)
self.assertIn(err_msg3, err_msg_list)
self.assertIn(err_msg4, err_msg_list)
self.assertIn(err_msg5, err_msg_list)
self.assertIn(err_msg6, err_msg_list)
self.assertIn(err_msg7, err_msg_list)
self.assertIn(err_msg8, err_msg_list)
self.assertIn(err_msg9, err_msg_list)
self.assertIn(err_msg10, err_msg_list)
err_msg_list = str(e).splitlines()
for msg in err_msg:
self.assertIn(msg, err_msg_list)

class TestEmptyKinetics(utilities.CanteraTest):
def test_empty(self):
Expand Down

0 comments on commit b3f2d32

Please sign in to comment.