summaryrefslogtreecommitdiff
path: root/_test/test_cyaml.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-08-29 12:42:05 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-08-29 12:42:05 +0200
commit375df52e3851ac08bf47cdaa12d319997c9a4a4a (patch)
treeaaf2d49de64dabdd5c1b2c5b2eefb85eed79b391 /_test/test_cyaml.py
parent1e94fe210166e1206f3a4e9843ac47ba9e736ba6 (diff)
downloadruamel.yaml-375df52e3851ac08bf47cdaa12d319997c9a4a4a.tar.gz
failing tests for CYaml 1.2 load/dump, re #155
Diffstat (limited to '_test/test_cyaml.py')
-rw-r--r--_test/test_cyaml.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/_test/test_cyaml.py b/_test/test_cyaml.py
index 2d67509..f6b54d5 100644
--- a/_test/test_cyaml.py
+++ b/_test/test_cyaml.py
@@ -2,6 +2,7 @@
import platform
import pytest
+from textwrap import dedent
@pytest.mark.skipif(
@@ -27,3 +28,43 @@ def test_dump_cyaml():
allow_unicode=True,
)
assert res == 'a: 1\nb: 2\n'
+
+@pytest.mark.xfail(strict=True)
+def test_load_cyaml_1_2():
+ # issue 155
+ import ruamel.yaml
+
+ assert ruamel.yaml.__with_libyaml__
+ inp = dedent("""\
+ %YAML 1.2
+ ---
+ num_epochs: 70000
+ """)
+ yaml = ruamel.yaml.YAML(typ='safe')
+ yaml.load(inp)
+
+@pytest.mark.xfail(strict=True)
+def test_dump_cyaml_1_2():
+ # issue 155
+ import ruamel.yaml
+ from ruamel.yaml.compat import StringIO
+
+ assert ruamel.yaml.__with_libyaml__
+ inp = dedent("""\
+ %YAML 1.2
+ ---
+ num_epochs: 70000
+ """)
+ yaml = ruamel.yaml.YAML(typ='safe')
+ yaml.version = (1, 2)
+ yaml.default_flow_style = False
+ data = {'a': 1, 'b': 2}
+ exp = dedent("""\
+ %YAML 1.2
+ ---
+ a: 1
+ b: 2
+ """)
+ buf = StringIO()
+ yaml.dump(data, buf)
+ assert buf.getvalue() == exp