diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-08-14 20:44:09 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-08-14 20:44:09 +0200 |
commit | 4c7259963b3f1bd92e7f5a863a737ef008e0e6dd (patch) | |
tree | 8b163f23fd56eac04246417cef96ca927a561ca2 /_test/roundtrip.py | |
parent | 21c1662a4c8367e1ce48811f78bcfe2830d06d58 (diff) | |
download | ruamel.yaml-4c7259963b3f1bd92e7f5a863a737ef008e0e6dd.tar.gz |
fix issue #51: separate indent levels for mappings and sequences0.15.29
**When this resolves the reported problem, please close this issue**
Diffstat (limited to '_test/roundtrip.py')
-rw-r--r-- | _test/roundtrip.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/_test/roundtrip.py b/_test/roundtrip.py index a00c4d4..0037437 100644 --- a/_test/roundtrip.py +++ b/_test/roundtrip.py @@ -145,3 +145,18 @@ class YAML(ruamel.yaml.YAML): res = sorted(res.splitlines()) expected = sorted(expected.splitlines()) assert res == expected + + def round_trip(self, stream, **kw): + assert isinstance(stream, ruamel.yaml.compat.text_type) + lkw = kw.copy() + if stream and stream[0] == '\n': + stream = stream[1:] + stream = textwrap.dedent(stream) + data = ruamel.yaml.YAML.load(self, stream) + outp = lkw.pop('outp', stream) + lkw['stream'] = st = StringIO() + ruamel.yaml.YAML.dump(self, data, **lkw) + res = st.getvalue() + if res != outp: + diff(outp, res, "input string") + assert res == outp |