summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-04-23 08:33:36 +0200
committerAnthon van der Neut <anthon@mnt.org>2019-04-23 08:33:36 +0200
commita648518ebda2003a61649c86938dd3846810a9b0 (patch)
tree18f7d93d37e50073fa3eb12f4af9138761f5228f /_test
parent0d1300c8b70de0ad2990b3f95629305dee870f0a (diff)
downloadruamel.yaml-a648518ebda2003a61649c86938dd3846810a9b0.tar.gz
add line-break to EOF comment without one0.15.94
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))*
Diffstat (limited to '_test')
-rw-r--r--_test/test_issues.py16
1 files changed, 16 insertions, 0 deletions
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 = """