diff options
author | Anthon van der Neut <anthon@mnt.org> | 2019-03-14 10:02:13 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2019-03-14 10:02:13 +0100 |
commit | 24bdc0073466057ba9288282f943205a32f3cdc8 (patch) | |
tree | 3c2975115bdfbc77ab911ce670a0a389e083f9ed | |
parent | eca512a9f7fb30edf74e012f3292115f6272138e (diff) | |
download | ruamel.yaml-24bdc0073466057ba9288282f943205a32f3cdc8.tar.gz |
make it test the real issue 160
-rw-r--r-- | _test/test_issues.py | 16 |
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("""\ |