summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
Diffstat (limited to '_test')
-rw-r--r--_test/test_api_change.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/_test/test_api_change.py b/_test/test_api_change.py
index b7c3290..9bb26b5 100644
--- a/_test/test_api_change.py
+++ b/_test/test_api_change.py
@@ -135,6 +135,20 @@ class TestRead:
yaml.load('a: 1')
yaml.load('a: 1') # did not work in 0.15.4
+ def test_parse(self):
+ # ensure `parse` method is functional and can parse "unsafe" yaml
+ from ruamel.yaml import YAML
+ from ruamel.yaml.constructor import ConstructorError
+
+ yaml = YAML(typ='safe')
+ s = '- !User0 {age: 18, name: Anthon}'
+ # should fail to load
+ with pytest.raises(ConstructorError):
+ yaml.load(s)
+ # should parse fine
+ for _ in yaml.parse(s):
+ pass
+
class TestLoadAll:
def test_multi_document_load(self, tmpdir):