summaryrefslogtreecommitdiff
path: root/_test/test_issues.py
diff options
context:
space:
mode:
Diffstat (limited to '_test/test_issues.py')
-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 = """