summaryrefslogtreecommitdiff
path: root/_test/roundtrip.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-06-10 22:59:06 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-06-10 22:59:06 +0200
commit0a26480139476afdd167bc6a900551463da92079 (patch)
tree4beeeb42c594498fae05bc46bc0ae0f0659e05d8 /_test/roundtrip.py
parent63929c2efaef82fa283983d989a08a79cff2e99a (diff)
downloadruamel.yaml-0a26480139476afdd167bc6a900551463da92079.tar.gz
top-level folded/literal scalar col-00.15.6
Diffstat (limited to '_test/roundtrip.py')
-rw-r--r--_test/roundtrip.py10
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)