From a648518ebda2003a61649c86938dd3846810a9b0 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Tue, 23 Apr 2019 08:33:36 +0200 Subject: add line-break to EOF comment without one fixes issue #286 *When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))* --- _test/test_issues.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to '_test') diff --git a/_test/test_issues.py b/_test/test_issues.py index 6392ebd..dd534ca 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -648,6 +648,22 @@ class TestIssues: assert not a[1] assert not a[3] + def test_issue_286(self): + from ruamel.yaml import YAML + from ruamel.yaml.compat import StringIO + + yaml = YAML() + inp = dedent("""\ + parent_key: + - sub_key: sub_value + + # xxx""") + a = yaml.load(inp) + a['new_key'] = 'new_value' + buf = StringIO() + yaml.dump(a, buf) + assert buf.getvalue().endswith('xxx\nnew_key: new_value\n') + # @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError) # def test_issue_ xxx(self): # inp = """ -- cgit v1.2.1