summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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)