summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-11-15 17:57:23 +0100
committerAnthon van der Neut <anthon@mnt.org>2018-11-15 17:57:23 +0100
commitd04c3b66d442bf9b727fd5201862014990f63cb4 (patch)
tree9330abe9c92eb4df95d45c35bb368ed28edc1696 /_test
parentbfe6cf135848a89b38286fec53d091e6402ef7c0 (diff)
downloadruamel.yaml-d04c3b66d442bf9b727fd5201862014990f63cb4.tar.gz
fix issue #261 Str, Num, Bytes, NameConstant moved from _ast to ast in 3.80.15.78
*When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to '_test')
-rw-r--r--_test/test_cyaml.py10
-rw-r--r--_test/test_yamlobject.py11
2 files changed, 17 insertions, 4 deletions
diff --git a/_test/test_cyaml.py b/_test/test_cyaml.py
index 5ac6f31..1d4c356 100644
--- a/_test/test_cyaml.py
+++ b/_test/test_cyaml.py
@@ -1,5 +1,6 @@
# coding: utf-8
+import sys
import platform
import pytest
from textwrap import dedent
@@ -11,15 +12,20 @@ from textwrap import dedent
def test_load_cyaml():
import ruamel.yaml
+ if sys.version_info >= (3, 8):
+ return
assert ruamel.yaml.__with_libyaml__
from ruamel.yaml.cyaml import CLoader
ruamel.yaml.load('abc: 1', Loader=CLoader)
+@pytest.mark.skipif(sys.version_info >= (3, 8), reason='no _PyGC_FINALIZED')
def test_dump_cyaml():
import ruamel.yaml
+ if sys.version_info >= (3, 8):
+ return
data = {'a': 1, 'b': 2}
res = ruamel.yaml.dump(
data,
@@ -34,6 +40,8 @@ def test_load_cyaml_1_2():
# issue 155
import ruamel.yaml
+ if sys.version_info >= (3, 8):
+ return
assert ruamel.yaml.__with_libyaml__
inp = dedent("""\
%YAML 1.2
@@ -49,6 +57,8 @@ def test_dump_cyaml_1_2():
import ruamel.yaml
from ruamel.yaml.compat import StringIO
+ if sys.version_info >= (3, 8):
+ return
assert ruamel.yaml.__with_libyaml__
yaml = ruamel.yaml.YAML(typ='safe')
yaml.version = (1, 2)
diff --git a/_test/test_yamlobject.py b/_test/test_yamlobject.py
index 376d4f8..7c4f7ec 100644
--- a/_test/test_yamlobject.py
+++ b/_test/test_yamlobject.py
@@ -56,11 +56,13 @@ def test_qualified_name00(tmpdir):
def f(self):
pass
- yaml = YAML(typ='unsafe')
+ yaml = YAML(typ='unsafe', pure=True)
+ yaml.explicit_end = True
buf = StringIO()
yaml.dump(A.f, buf)
res = buf.getvalue()
- assert res == '!!python/name:__main__.A.f \\n...\\n'
+ print('res', repr(res))
+ assert res == "!!python/name:__main__.A.f ''\\n...\\n"
x = yaml.load(res)
assert x == A.f
"""
@@ -74,10 +76,11 @@ def test_qualified_name01(tmpdir):
import ruamel.yaml.comments
from ruamel.yaml.compat import StringIO
- yaml = YAML(typ='unsafe')
+ yaml = YAML(typ='unsafe', pure=True)
+ yaml.explicit_end = True
buf = StringIO()
yaml.dump(ruamel.yaml.comments.CommentedBase.yaml_anchor, buf)
res = buf.getvalue()
- assert res == '!!python/name:ruamel.yaml.comments.CommentedBase.yaml_anchor \n...\n'
+ assert res == "!!python/name:ruamel.yaml.comments.CommentedBase.yaml_anchor ''\n...\n"
x = yaml.load(res)
assert x == ruamel.yaml.comments.CommentedBase.yaml_anchor