From 638b3d07b210f8636507c1530e925445f9c3aba9 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Sat, 27 Feb 2016 14:53:44 +0100 Subject: implement indent for scalar list elements --- _test/test_fail.py | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to '_test/test_fail.py') diff --git a/_test/test_fail.py b/_test/test_fail.py index de5bdb8..852fde7 100644 --- a/_test/test_fail.py +++ b/_test/test_fail.py @@ -87,12 +87,33 @@ class TestIndentFailures: a: - foo - bar - """), indent=4) == dedent(""" + """)) == dedent(""" a: - foo - bar """) + @pytest.mark.xfail + def test_roundtrip_four_space_indents_expl_indent(self): + s = ( + 'a:\n' + '- foo\n' + '- bar\n' + ) + output = round_trip_dump(round_trip_load(s), indent=4) + assert s == output + + def test_roundtrip_four_space_indents_expl_indent_no_fail(self): + assert round_trip_dump(round_trip_load(""" + a: + - foo + - bar + """), indent=4) == dedent(""" + a: + - foo + - bar + """) + @pytest.mark.xfail def test_indent_not_retained(self): round_trip(""" @@ -145,9 +166,9 @@ class TestIndentFailures: base_url: http://gopher.net special_indices: [1, 5, 8] also_special: - - a - - 19 - - 32 + - a + - 19 + - 32 asia and europe: &asia_europe Turkey: Ankara Russia: Moscow @@ -160,17 +181,10 @@ class TestIndentFailures: Spain: Madrid Italy: Rome Antarctica: - - too cold + - too cold """) - @pytest.mark.xfail - def test_indent_top_level(self): - round_trip(""" - - a: - - b - """, indent=4) - - def test_indent_top_level_no_fail(self): + def Xtest_indent_top_level_no_fail(self): round_trip(""" - a: - b -- cgit v1.2.1