Skip to content

Commit

Permalink
[YAML] Append rather than replace extra description
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Feb 10, 2020
1 parent 40629d9 commit f8841f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion interfaces/cython/cantera/ck2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 2 additions & 3 deletions interfaces/cython/cantera/test/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit f8841f8

Please sign in to comment.