diff options
author | Anthon van der Neut <anthon@mnt.org> | 2023-05-06 12:29:03 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2023-05-06 12:29:03 +0200 |
commit | a7e27772f48e9e7f1040344739f680081da50a41 (patch) | |
tree | 0887b210272f81e1a01e6404e1e1aac25e4558f3 /_test | |
parent | a4e09a2ba0d2adb1b2e63b6bf8fa39c055b9c99b (diff) | |
download | ruamel.yaml-a7e27772f48e9e7f1040344739f680081da50a41.tar.gz |
fix issue: 453, 4470.17.24
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 ce78cce..eadf94d 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -954,6 +954,11 @@ class TestIssues: yaml.dump(data, buf) assert buf.getvalue() == '%YAML 1.1\n---\nquote: I have seen things\n' + def test_issue_447(self) -> None: + from ruamel.yaml import YAML + + YAML().load("{\n\t\"FOO\": \"BAR\"\n}") + def test_issue_449(self) -> None: inp = """\ emoji_index: !!python/name:materialx.emoji.twemoji @@ -974,6 +979,32 @@ class TestIssues: assert ord(k) == v assert len(cm) == 4 + def test_issue_453(self) -> None: + from io import StringIO + from ruamel.yaml import YAML + + inp = dedent( + """ + to-merge: &anchor + merge-key: should not be duplicated + + to-merge2: &anchor2 + merge-key2: should not be duplicated + + usage: + <<: [*anchor, *anchor2] + usage-key: usage-value + """ + ) + yaml = YAML() + data = yaml.load(inp) + data['usage'].insert(0, 'insert-key', 'insert-value') + out_stream = StringIO() + yaml.dump(data, out_stream) + result = out_stream.getvalue() + print(result) + assert inp.replace('usage:\n', 'usage:\n insert-key: insert-value\n') == result + def test_issue_454(self) -> None: inp = """ test1: 🎉 |