summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-05-03 01:15:21 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-05-03 01:15:21 +0200
commit2c8d2cd5c9bf3074bd70559a850d77bd3a28ae8d (patch)
tree4ffd3f7b25661e0fb36fc0fc41fb58def584f8c3 /tests
parent56a5db608f457259f7e69a5e01225adaf7016a31 (diff)
downloadfactory-boy-2c8d2cd5c9bf3074bd70559a850d77bd3a28ae8d.tar
factory-boy-2c8d2cd5c9bf3074bd70559a850d77bd3a28ae8d.tar.gz
Add LazyStub.factory_parent (See #55).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_containers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_containers.py b/tests/test_containers.py
index 70ed885..75e3237 100644
--- a/tests/test_containers.py
+++ b/tests/test_containers.py
@@ -68,6 +68,16 @@ class LazyStubTestCase(unittest.TestCase):
containers=())
self.assertEqual(2, stub.one)
+ def test_access_parent(self):
+ """Test simple access to a stub' parent."""
+ o1 = containers.LazyStub({'rank': 1})
+ o2 = containers.LazyStub({'rank': 2}, (o1,))
+ stub = containers.LazyStub({'rank': 3}, (o2, o1))
+
+ self.assertEqual(3, stub.rank)
+ self.assertEqual(2, stub.factory_parent.rank)
+ self.assertEqual(1, stub.factory_parent.factory_parent.rank)
+
def test_cyclic_definition(self):
class LazyAttr(containers.LazyValue):
def __init__(self, attrname):