summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-03-14 10:02:13 +0100
committerAnthon van der Neut <anthon@mnt.org>2019-03-14 10:02:13 +0100
commit24bdc0073466057ba9288282f943205a32f3cdc8 (patch)
tree3c2975115bdfbc77ab911ce670a0a389e083f9ed /_test
parenteca512a9f7fb30edf74e012f3292115f6272138e (diff)
downloadruamel.yaml-24bdc0073466057ba9288282f943205a32f3cdc8.tar.gz
make it test the real issue 160
Diffstat (limited to '_test')
-rw-r--r--_test/test_issues.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py
index 4780da5..0d1a43d 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -112,6 +112,7 @@ class TestIssues:
assert 'second' in dict(**child)
def test_issue_160(self):
+ from ruamel.yaml.compat import StringIO
s = dedent("""\
root:
# a comment
@@ -120,8 +121,19 @@ class TestIssues:
foo: 32
bar: 32
""")
- x = round_trip(s, block_seq_indent=4, preserve_quotes=True)
- assert x['bar'] == 32
+ a = round_trip_load(s)
+ del a['root'][0]['some_key']
+ buf = StringIO()
+ round_trip_dump(a, buf, block_seq_indent=4)
+ exp = dedent("""\
+ root:
+ # a comment
+ - {}
+
+ foo: 32
+ bar: 32
+ """)
+ assert buf.getvalue() == exp
def test_issue_161(self):
yaml_str = dedent("""\