summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-09-20 13:30:40 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-09-20 13:30:40 +0200
commit8d476d15a89171e3fea33e27274f54fe36ca87f2 (patch)
tree3e451060cfc050fed77212c37436a40edcfbd8a9
parentd86f67d2e0c3f730c9c8309bd28c5318c4ebcedd (diff)
downloadruamel.yaml-8d476d15a89171e3fea33e27274f54fe36ca87f2.tar.gz
added failing test, re #238
-rw-r--r--_test/test_issues.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py
index 3a56ccc..3ead121 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -450,6 +450,39 @@ 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'''
+ 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
+
# def test_issue_xxx(self):
# inp = """