diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-08-17 13:15:20 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-08-17 13:15:20 +0200 |
commit | d8b794cccf8054a73ae61b6128e342b23b390e1d (patch) | |
tree | 26a8aa35793c493044fb52524434715630872419 /_test | |
parent | b7333fbcfa612f59ec745e5c7d425ee48a947fa2 (diff) | |
download | ruamel.yaml-d8b794cccf8054a73ae61b6128e342b23b390e1d.tar.gz |
operator "in" for merged maps
Diffstat (limited to '_test')
-rw-r--r-- | _test/test_comments.py | 18 | ||||
-rw-r--r-- | _test/test_fail.py | 12 |
2 files changed, 24 insertions, 6 deletions
diff --git a/_test/test_comments.py b/_test/test_comments.py index b6b12e2..0cab926 100644 --- a/_test/test_comments.py +++ b/_test/test_comments.py @@ -472,3 +472,21 @@ class TestInsertInMapping: about: Art Vandelay is a fictional character that George invents... last name: Vandelay # new key """) + + +class TestCommentedMapMerge: + def test_in_operator(self): + data = round_trip_load(""" + x: &base + a: 1 + b: 2 + c: 3 + y: + <<: *base + k: 4 + l: 5 + """) + assert data['x']['a'] == 1 + assert 'a' in data['x'] + assert data['y']['a'] == 1 + assert 'a' in data['y'] diff --git a/_test/test_fail.py b/_test/test_fail.py index 852fde7..34516a0 100644 --- a/_test/test_fail.py +++ b/_test/test_fail.py @@ -12,7 +12,7 @@ from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump class TestCommentFailures: - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_set_comment_before_tag(self): # no comments before tags round_trip(""" @@ -47,7 +47,7 @@ class TestCommentFailures: # this is the end """) - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_comment_dash_line(self): round_trip(""" - # abc @@ -72,7 +72,7 @@ class TestCommentFailures: class TestIndentFailures: - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_roundtrip_four_space_indents(self): s = ( 'a:\n' @@ -93,7 +93,7 @@ class TestIndentFailures: - bar """) - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_roundtrip_four_space_indents_expl_indent(self): s = ( 'a:\n' @@ -114,7 +114,7 @@ class TestIndentFailures: - bar """) - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_indent_not_retained(self): round_trip(""" verbosity: 1 # 0 is minimal output, -1 none @@ -192,7 +192,7 @@ class TestIndentFailures: class TestTagFailures: - @pytest.mark.xfail + @pytest.mark.xfail(strict=True) def test_standard_short_tag(self): round_trip("""\ !!map |