summaryrefslogtreecommitdiff
path: root/_test/test_comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-02-12 17:55:11 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-02-12 17:55:11 +0100
commit42045042017443f395a97b134516672d56766732 (patch)
tree764999c10468ed0ddedeceb2024c0c44012f63b8 /_test/test_comments.py
parentbbd2e8ac8fb9ba2aee8b8f95cc5e9c05d46b79cd (diff)
downloadruamel.yaml-42045042017443f395a97b134516672d56766732.tar.gz
fix #99: no RT on block scalar + empty line + comment0.13.14
Diffstat (limited to '_test/test_comments.py')
-rw-r--r--_test/test_comments.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/_test/test_comments.py b/_test/test_comments.py
index 78daa5e..d1ef7fb 100644
--- a/_test/test_comments.py
+++ b/_test/test_comments.py
@@ -735,3 +735,24 @@ class TestEmptyValueBeforeComments:
a: 1 # comment a
b: # comment b
""")
+
+test_block_scalar_commented_line_template = """\
+y: p
+# Some comment
+
+a: |
+ x
+{}b: y
+"""
+
+
+class TestBlockScalarWithComments:
+ # issue 99 reported by Colm O'Connor
+
+ for x in ['', '\n', '\n# Another comment\n', '\n\n', '\n\n# abc\n#xyz\n',
+ '\n\n# abc\n#xyz\n', '# abc\n\n#xyz\n', '\n\n # abc\n #xyz\n']:
+
+ commented_line = test_block_scalar_commented_line_template.format(x)
+ data = ruamel.yaml.round_trip_load(commented_line)
+
+ assert ruamel.yaml.round_trip_dump(data) == commented_line