diff options
Diffstat (limited to '_test/test_api_change.py')
-rw-r--r-- | _test/test_api_change.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/_test/test_api_change.py b/_test/test_api_change.py new file mode 100644 index 0000000..10997f4 --- /dev/null +++ b/_test/test_api_change.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +""" +testing of anchors and the aliases referring to them +""" + +import pytest +from ruamel.yaml import YAML +from ruamel.yaml.constructor import DuplicateKeyError + + +class TestNewAPI: + def test_duplicate_keys_00(self): + from ruamel.yaml.constructor import DuplicateKeyError + yaml = YAML() + with pytest.raises(DuplicateKeyError): + yaml.load('{a: 1, a: 2}') + + def test_duplicate_keys_01(self): + yaml = YAML(typ='safe', pure=True) + with pytest.raises(DuplicateKeyError): + yaml.load('{a: 1, a: 2}') + + # @pytest.mark.xfail(strict=True) + def test_duplicate_keys_02(self): + yaml = YAML(typ='safe') + with pytest.raises(DuplicateKeyError): + yaml.load('{a: 1, a: 2}') |