diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-29 12:42:05 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-29 12:42:05 +0200 |
commit | 375df52e3851ac08bf47cdaa12d319997c9a4a4a (patch) | |
tree | aaf2d49de64dabdd5c1b2c5b2eefb85eed79b391 /_test | |
parent | 1e94fe210166e1206f3a4e9843ac47ba9e736ba6 (diff) | |
download | ruamel.yaml-375df52e3851ac08bf47cdaa12d319997c9a4a4a.tar.gz |
failing tests for CYaml 1.2 load/dump, re #155
Diffstat (limited to '_test')
-rw-r--r-- | _test/test_cyaml.py | 41 |
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 |