diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-11-27 16:06:46 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-11-27 16:24:07 -0200 |
commit | 396c6b7ea7f774c60a44b36617bf7a767c208d59 (patch) | |
tree | f1cf222b8049a27888f3ef58eb87f979c2b8f740 /tests | |
parent | cd074d305fddf1a3aced9513909adcf9ce632975 (diff) |
Small fixes for parent/child unit tests
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/samplebinding/ownership_delete_parent_test.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/samplebinding/ownership_delete_parent_test.py b/tests/samplebinding/ownership_delete_parent_test.py index 1e70a905e..c55f5df2c 100755 --- a/tests/samplebinding/ownership_delete_parent_test.py +++ b/tests/samplebinding/ownership_delete_parent_test.py @@ -51,28 +51,22 @@ class DeleteParentTest(unittest.TestCase): parent = ObjectType() children = [ObjectType(parent) for _ in range(10)] - refcount_before = map(sys.getrefcount, children) - del parent for i, child in enumerate(children): self.assertRaises(RuntimeError, child.objectName) - self.assertEqual(sys.getrefcount(child), refcount_before[i]-1) + self.assertEqual(sys.getrefcount(child), 4) def testRecursiveParentDelete(self): '''Delete parent should invalidate grandchildren''' - parent = ObjectType() child = ObjectType(parent) grandchild = ObjectType(child) - refcount_before = sys.getrefcount(child) - grand_refcount_before = sys.getrefcount(grandchild) - del parent self.assertRaises(RuntimeError, child.objectName) - self.assertEqual(sys.getrefcount(child), refcount_before-1) + self.assertEqual(sys.getrefcount(child), 2) self.assertRaises(RuntimeError, grandchild.objectName) - self.assertEqual(sys.getrefcount(grandchild), grand_refcount_before-1) + self.assertEqual(sys.getrefcount(grandchild), 2) if __name__ == '__main__': |