Add test to check that error messages from ctml_writer are propagated

This commit is contained in:
Ray Speth 2014-05-06 14:39:54 +00:00
parent bc0346eae7
commit 9cddf5aaed
2 changed files with 14 additions and 0 deletions

View file

@ -324,3 +324,11 @@ class CtmlConverterTest(utilities.CanteraTest):
def test_pdep(self):
gas = ct.Solution('../data/pdep-test.cti')
self.assertEqual(gas.n_reactions, 6)
def test_invalid(self):
try:
gas = ct.Solution('../data/invalid.cti')
except RuntimeError as e:
err = e
self.assertIn('Multiply-declared species', err.args[0])

6
test/data/invalid.cti Normal file
View file

@ -0,0 +1,6 @@
ideal_gas(
name="complete",
elements=" C H O",
species="gri30: O2 CH4 H2O CO2 CH4",
initial_state=state(temperature=298.0,
pressure = 100000.0))