diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-06-10 22:59:06 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-06-10 22:59:06 +0200 |
commit | 0a26480139476afdd167bc6a900551463da92079 (patch) | |
tree | 4beeeb42c594498fae05bc46bc0ae0f0659e05d8 /_test/roundtrip.py | |
parent | 63929c2efaef82fa283983d989a08a79cff2e99a (diff) | |
download | ruamel.yaml-0a26480139476afdd167bc6a900551463da92079.tar.gz |
top-level folded/literal scalar col-00.15.6
Diffstat (limited to '_test/roundtrip.py')
-rw-r--r-- | _test/roundtrip.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/_test/roundtrip.py b/_test/roundtrip.py index cea1d81..7540bcd 100644 --- a/_test/roundtrip.py +++ b/_test/roundtrip.py @@ -90,3 +90,13 @@ def round_trip(inp, outp=None, extra=None, intermediate=None, indent=None, version=version) print('roundtrip second round data:\n', res, sep='') assert res == doutp + + +class YAML(ruamel.yaml.YAML): + """auto dedent string parameters on load""" + def load(self, stream): + if isinstance(stream, str): + if stream and stream[0] == '\n': + stream = stream[1:] + stream = textwrap.dedent(stream) + return ruamel.yaml.YAML.load(self, stream) |