summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-04-16 08:46:25 +0200
committerAnthon van der Neut <anthon@mnt.org>2019-04-16 08:46:25 +0200
commite0a5db9c8b1df89db6ee0195cb9e304eee34b7ed (patch)
treeeb59e8cdd66a1ca8869f508f5ba9a0eda4e554dd /_test
parentf26a259a769edcf9a62233ea3c605c92dc3c8073 (diff)
downloadruamel.yaml-e0a5db9c8b1df89db6ee0195cb9e304eee34b7ed.tar.gz
YAML 1.2 allows empty implicit keys in block style mappings0.15.92
fixes issue #284 *When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to '_test')
-rw-r--r--_test/test_issues.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py
index 5007f60..dd6910b 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -612,6 +612,23 @@ class TestIssues:
assert 'c' in yaml_data.keys()
assert 'c' in yaml_data._ok
+ def test_issue_284(self):
+ import ruamel.yaml
+ inp = dedent("""\
+ plain key: in-line value
+ : # Both empty
+ "quoted key":
+ - entry
+ """)
+ yaml = ruamel.yaml.YAML(typ='rt')
+ yaml.version = (1, 2)
+ d = yaml.load(inp)
+ assert d[None] is None
+
+ yaml = ruamel.yaml.YAML(typ='rt')
+ yaml.version = (1, 1)
+ with pytest.raises(ruamel.yaml.parser.ParserError, match='expected <block end>'):
+ d = yaml.load(inp)
# @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError)
# def test_issue_ xxx(self):