diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index b43a086d3..188bed517 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -1390,10 +1390,7 @@ class Parser(object): alpha = float(tokens[0].strip()) T3 = float(tokens[1].strip()) T1 = float(tokens[2].strip()) - try: - T2 = float(tokens[3].strip()) - except (IndexError, ValueError): - T2 = None + T2 = float(tokens[3].strip()) if len(tokens) > 3 else None falloff = Troe( alpha=(alpha,''), diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index 39879fef9..27c0a5c54 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -278,6 +278,12 @@ class chemkinConverterTest(utilities.CanteraTest): 'explicit-forward-order.cti') self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6]) + def test_bad_troe_value(self): + with self.assertRaises(ValueError): + convertMech(pjoin(self.test_data_dir, 'bad-troe.inp'), + thermoFile=pjoin(self.test_data_dir, 'dummy-thermo.dat'), + outName=pjoin(self.test_work_dir, 'bad-troe.cti'), quiet=True) + def test_reaction_units(self): convertMech(pjoin(self.test_data_dir, 'units-default.inp'), thermoFile=pjoin(self.test_data_dir, 'dummy-thermo.dat'), diff --git a/test/data/bad-troe.inp b/test/data/bad-troe.inp new file mode 100644 index 000000000..6447028c7 --- /dev/null +++ b/test/data/bad-troe.inp @@ -0,0 +1,13 @@ +ELEMENTS +H C +END + +SPECIES +H R1A R1B P1 +END + +REACTIONS +R1A+R1B(+M) <=> H+P1(+M) 1e12 0.0 20000.0 + LOW / 1.040E+26 -2.760 1600.00/ + TROE/ .5620 91.00 5836.00 1.00000+100/ +END