summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-05-16 00:31:23 +0200
committerAnthon van der Neut <anthon@mnt.org>2019-05-16 00:31:23 +0200
commitfd003083b6954ec1d5827984abb8ed61de400915 (patch)
tree3cef27f13dd41f9a3c019e06912805245a78f715 /_test
parent399330be1abc4ab510cc4dabe8ff1bb2378dc08f (diff)
downloadruamel.yaml-fd003083b6954ec1d5827984abb8ed61de400915.tar.gz
fix comments on anchored nodes in block sequence0.15.95
fixes issue #288
Diffstat (limited to '_test')
-rw-r--r--_test/test_issues.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py
index dd534ca..ec7d95d 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -664,6 +664,37 @@ class TestIssues:
yaml.dump(a, buf)
assert buf.getvalue().endswith('xxx\nnew_key: new_value\n')
+ def test_issue_288(self):
+ import sys
+ from ruamel.yaml.compat import StringIO
+ from ruamel.yaml import YAML
+
+ yamldoc = dedent("""\
+ ---
+ # Reusable values
+ aliases:
+ # First-element comment
+ - &firstEntry First entry
+ # Second-element comment
+ - &secondEntry Second entry
+
+ # Third-element comment is
+ # a multi-line value
+ - &thirdEntry Third entry
+
+ # EOF Comment
+ """)
+
+ yaml = YAML()
+ yaml.indent(mapping=2, sequence=4, offset=2)
+ yaml.explicit_start = True
+ yaml.preserve_quotes = True
+ yaml.width = sys.maxsize
+ data = yaml.load(yamldoc)
+ buf = StringIO()
+ yaml.dump(data, buf)
+ assert buf.getvalue() == yamldoc
+
# @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError)
# def test_issue_ xxx(self):
# inp = """