From f8841f899284ad4e392521d5d75f8bd56ac829bf Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Mon, 10 Feb 2020 09:35:53 -0600 Subject: [PATCH] [YAML] Append rather than replace extra description --- interfaces/cython/cantera/ck2yaml.py | 4 +++- interfaces/cython/cantera/test/test_convert.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interfaces/cython/cantera/ck2yaml.py b/interfaces/cython/cantera/ck2yaml.py index 24c47c6a288..c77c786ba56 100644 --- a/interfaces/cython/cantera/ck2yaml.py +++ b/interfaces/cython/cantera/ck2yaml.py @@ -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())