diff --git a/interfaces/cython/cantera/ck2yaml.py b/interfaces/cython/cantera/ck2yaml.py index 24c47c6a288..95185451978 100644 --- a/interfaces/cython/cantera/ck2yaml.py +++ b/interfaces/cython/cantera/ck2yaml.py @@ -39,8 +39,8 @@ is used to override default phase names (i.e. 'gas'). The '--extra=' option takes a YAML file as input. This option can be -used to specify an alternative file description, or to define custom fields that -are included in the YAML output. +used to add to the file description, or to define custom fields that are +included in the YAML output. """ from collections import defaultdict, OrderedDict @@ -1355,7 +1355,9 @@ def load_extra_file(self, path): # replace header lines if 'description' in yml: if isinstance(yml['description'], str): - self.header_lines = yml.pop('description').split('\n') + if self.header_lines: + self.header_lines += [''] + self.header_lines += yml.pop('description').split('\n') else: raise InputError("The alternate description provided in " "'{}' needs to be a string".format(path)) diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index 44f075d654d..b6eb099ed89 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -454,9 +454,8 @@ def test_extra(self): with open(output, 'rt', encoding="utf-8") as stream: yml = yaml.safe_load(stream) - desc = yml['description'] - self.assertEqual(yml['description'], - 'This is an alternative description.') + desc = yml['description'].split()[-1] + self.assertEqual(desc, 'This is an alternative description.') for key in ['foo', 'bar']: self.assertIn(key, yml.keys())