summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2007-01-20 14:30:45 +0000
committerJohan Dahlin <johan@src.gnome.org>2007-01-20 14:30:45 +0000
commit77f99ac0c0717ee20b701d5c20fea0f00ed4bc40 (patch)
tree8f3fc407beb922c1381952a6c2704a270cfcc2ef /tests
parent74620bd24024fd22e43a2f56b757ad631db7e667 (diff)
downloadpygtk-77f99ac0c0717ee20b701d5c20fea0f00ed4bc40.tar.gz
clean up gc collection
svn path=/trunk/; revision=2807
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gdk.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/tests/test_gdk.py b/tests/test_gdk.py
index 77fe5cc1..e23c4583 100644
--- a/tests/test_gdk.py
+++ b/tests/test_gdk.py
@@ -47,6 +47,15 @@ class GdkTest(unittest.TestCase):
1,
[0xdeadbe, 0xbebabe])
+ def _collect(self):
+ cnt = 0
+ while True:
+ x = gc.collect()
+ cnt += x
+ if x:
+ break
+ return cnt
+
def testDisplay(self):
while gc.collect():
pass
@@ -54,22 +63,11 @@ class GdkTest(unittest.TestCase):
display = gtk.gdk.Display(None)
del display
- cnt = 0
- while True:
- x = gc.collect()
- cnt += x
- if x:
- break
- self.assertEquals(cnt, 1)
-
+ self.assertEquals(self._collect(), 1)
+
display = gtk.gdk.Display(None)
+ self.assertEquals(display.__grefcount__, 1)
display.close()
+ self.assertEquals(display.__grefcount__, 1)
del display
-
- cnt = 0
- while True:
- x = gc.collect()
- cnt += x
- if x:
- break
- self.assertEquals(cnt, 1)
+ self.assertEquals(self._collect(), 1)