summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-09-20 14:03:50 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-09-20 14:03:50 +0200
commit16f8549847cc61715ef5db70cfab8699c8360ae9 (patch)
tree5bdbecf9129c8c559d025f3b628c6a092b9ba3ca /_test
parent8d476d15a89171e3fea33e27274f54fe36ca87f2 (diff)
downloadruamel.yaml-16f8549847cc61715ef5db70cfab8699c8360ae9.tar.gz
fix issue #238 incompatibility between __setstate__ and recursive parameters0.15.68
*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_issues.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py
index 3ead121..0612be1 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -450,37 +450,36 @@ class TestIssues:
"""
d = round_trip(inp, preserve_quotes=True) # NOQA
- @pytest.mark.xfail(strict=True, reason='resolving __setstate__', raises=AssertionError)
def test_issue_238(self, tmpdir):
- program_src = r'''
+ program_src = r"""
import ruamel.yaml
from ruamel.yaml.compat import StringIO
yaml = ruamel.yaml.YAML(typ='unsafe')
-
-
+
+
class A:
def __setstate__(self, d):
self.__dict__ = d
-
+
class B:
pass
-
-
+
+
a = A()
b = B()
-
+
a.x = b
b.y = [b]
assert a.x.y[0] == a.x
-
+
buf = StringIO()
yaml.dump(a, buf)
-
+
data = yaml.load(buf.getvalue())
assert data.x.y[0] == data.x
- '''
+ """
assert save_and_run(dedent(program_src), tmpdir) == 0