diff options
-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 |