summaryrefslogtreecommitdiff
path: root/tests/test_using.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_using.py')
-rw-r--r--tests/test_using.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_using.py b/tests/test_using.py
index f18df4d..8d78789 100644
--- a/tests/test_using.py
+++ b/tests/test_using.py
@@ -1938,6 +1938,23 @@ class CircularTestCase(unittest.TestCase):
self.assertIsNone(b.foo.bar.foo.bar)
+class SelfReferentialTests(unittest.TestCase):
+ def test_no_parent(self):
+ from .cyclic import self_ref
+
+ obj = self_ref.TreeElementFactory(parent=None)
+ self.assertIsNone(obj.parent)
+
+ def test_deep(self):
+ from .cyclic import self_ref
+
+ obj = self_ref.TreeElementFactory(parent__parent__parent__parent=None)
+ self.assertIsNotNone(obj.parent)
+ self.assertIsNotNone(obj.parent.parent)
+ self.assertIsNotNone(obj.parent.parent.parent)
+ self.assertIsNone(obj.parent.parent.parent.parent)
+
+
class DictTestCase(unittest.TestCase):
def test_empty_dict(self):
class TestObjectFactory(factory.Factory):