summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-11-27 16:06:46 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-11-27 16:24:07 -0200
commit396c6b7ea7f774c60a44b36617bf7a767c208d59 (patch)
treef1cf222b8049a27888f3ef58eb87f979c2b8f740
parentcd074d305fddf1a3aced9513909adcf9ce632975 (diff)
downloadshiboken-396c6b7ea7f774c60a44b36617bf7a767c208d59.tar.gz
shiboken-396c6b7ea7f774c60a44b36617bf7a767c208d59.tar.xz
shiboken-396c6b7ea7f774c60a44b36617bf7a767c208d59.zip
Small fixes for parent/child unit tests
-rwxr-xr-xtests/samplebinding/ownership_delete_parent_test.py12
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 1e70a905..c55f5df2 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__':