summaryrefslogtreecommitdiff
path: root/_test/test_comment_manipulation.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-09 11:03:04 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-09 11:03:04 +0200
commitb3b5301e1b0a21d81a2ec1501df9ef92abac5ce2 (patch)
tree3728d199188d082ceba1613eaaa7f1bd8d79c350 /_test/test_comment_manipulation.py
parentbb292fb88d1e5f6d8a3139e94e0678ce4c55ac1f (diff)
downloadruamel.yaml-b3b5301e1b0a21d81a2ec1501df9ef92abac5ce2.tar.gz
update tests
Diffstat (limited to '_test/test_comment_manipulation.py')
-rw-r--r--_test/test_comment_manipulation.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/_test/test_comment_manipulation.py b/_test/test_comment_manipulation.py
index dfb6ff6..7586954 100644
--- a/_test/test_comment_manipulation.py
+++ b/_test/test_comment_manipulation.py
@@ -11,8 +11,8 @@ def load(s):
return round_trip_load(dedent(s))
-def compare(data, s):
- assert round_trip_dump(data) == dedent(s)
+def compare(data, s, **kw):
+ assert round_trip_dump(data, **kw) == dedent(s)
def compare_eol(data, s):
@@ -385,9 +385,27 @@ class TestCommentsManipulation:
b:
# Hello
# World
+ - c
+ - d
+ """.format(comment='#'))
+
+ def test_before_nested_seq_from_scratch_block_seq_indent(self):
+ from ruamel.yaml.comments import CommentedMap, CommentedSeq
+ data = CommentedMap()
+ datab = CommentedSeq()
+ data['a'] = 1
+ data['b'] = datab
+ datab.append('c')
+ datab.append('d')
+ data['b'].yaml_set_start_comment('Hello\nWorld\n', indent=2)
+ compare(data, """
+ a: 1
+ b:
+ # Hello
+ # World
- c
- d
- """.format(comment='#'))
+ """.format(comment='#'), indent=4, block_seq_indent=2)
def test_map_set_comment_before_and_after_non_first_key_00(self):
# http://stackoverflow.com/a/40705671/1307905