From 9cddf5aaedeef6c116ebb2cd4510c815105b6529 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 6 May 2014 14:39:54 +0000 Subject: [PATCH] Add test to check that error messages from ctml_writer are propagated --- interfaces/cython/cantera/test/test_convert.py | 8 ++++++++ test/data/invalid.cti | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 test/data/invalid.cti diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index 65c60647a..b855ee7e8 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -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]) diff --git a/test/data/invalid.cti b/test/data/invalid.cti new file mode 100644 index 000000000..fcc231734 --- /dev/null +++ b/test/data/invalid.cti @@ -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))