diff options
author | Anthon van der Neut <anthon@mnt.org> | 2019-05-16 00:31:23 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2019-05-16 00:31:23 +0200 |
commit | fd003083b6954ec1d5827984abb8ed61de400915 (patch) | |
tree | 3cef27f13dd41f9a3c019e06912805245a78f715 /_test | |
parent | 399330be1abc4ab510cc4dabe8ff1bb2378dc08f (diff) | |
download | ruamel.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.py | 31 |
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 = """ |