[pygi] Move some tests from test_gi to test_everything
- From: Zach Goldberg <zgoldberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] Move some tests from test_gi to test_everything
- Date: Sun, 18 Apr 2010 15:24:24 +0000 (UTC)
commit 7d533b8893bc4a8a82fd9708278fa1dce5d3551e
Author: Zach Goldberg <zach zachgoldberg com>
Date: Sat Apr 17 12:56:19 2010 -0400
Move some tests from test_gi to test_everything
tests/test_everything.py | 60 ++++++++++++++++++++++++++++++++++++++++++++
tests/test_gi.py | 62 +---------------------------------------------
2 files changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 60e8f9d..8347081 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -46,3 +46,63 @@ class TestEverything(unittest.TestCase):
self.assertEquals(surface.get_width(), 10)
self.assertEquals(surface.get_height(), 10)
+class TestCallbacks(unittest.TestCase):
+ called = False
+ def testCallback(self):
+ TestCallbacks.called = False
+ def callback():
+ TestCallbacks.called = True
+
+ Everything.test_simple_callback(callback)
+ self.assertTrue(TestCallbacks.called)
+
+ def testCallbackException(self):
+ """
+ This test ensures that we get errors from callbacks correctly
+ and in particular that we do not segv when callbacks fail
+ """
+ def callback():
+ x = 1 / 0
+
+ try:
+ Everything.test_simple_callback(callback)
+ except ZeroDivisionError:
+ pass
+
+ def testDoubleCallbackException(self):
+ """
+ This test ensures that we get errors from callbacks correctly
+ and in particular that we do not segv when callbacks fail
+ """
+ def badcallback():
+ x = 1 / 0
+
+ def callback():
+ Everything.test_boolean(True)
+ Everything.test_boolean(False)
+ Everything.test_simple_callback(badcallback())
+
+ try:
+ Everything.test_simple_callback(callback)
+ except ZeroDivisionError:
+ pass
+
+ def testReturnValueCallback(self):
+ TestCallbacks.called = False
+ def callback():
+ TestCallbacks.called = True
+ return 44
+
+ self.assertEquals(Everything.test_callback(callback), 44)
+ self.assertTrue(TestCallbacks.called)
+
+ def testCallbackAsync(self):
+ TestCallbacks.called = False
+ def callback(foo):
+ TestCallbacks.called = True
+ return foo
+
+ Everything.test_callback_async(callback, 44);
+ i = Everything.test_callback_thaw_async();
+ self.assertEquals(44, i);
+ self.assertTrue(TestCallbacks.called)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index a9076b6..b37dce4 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -12,7 +12,7 @@ from datetime import datetime
import sys
sys.path.insert(0, "../")
-from gi.repository import GIMarshallingTests, Everything
+from gi.repository import GIMarshallingTests
CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8"
@@ -1401,63 +1401,3 @@ class TestOverrides(unittest.TestCase):
self.assertTrue(isinstance(object_, GIMarshallingTests.OverridesObject))
-class TestCallbacks(unittest.TestCase):
- called = False
- def testCallback(self):
- TestCallbacks.called = False
- def callback():
- TestCallbacks.called = True
-
- Everything.test_simple_callback(callback)
- self.assertTrue(TestCallbacks.called)
-
- def testCallbackException(self):
- """
- This test ensures that we get errors from callbacks correctly
- and in particular that we do not segv when callbacks fail
- """
- def callback():
- x = 1 / 0
-
- try:
- Everything.test_simple_callback(callback)
- except ZeroDivisionError:
- pass
-
- def testDoubleCallbackException(self):
- """
- This test ensures that we get errors from callbacks correctly
- and in particular that we do not segv when callbacks fail
- """
- def badcallback():
- x = 1 / 0
-
- def callback():
- GIMarshallingTests.boolean_return_true()
- GIMarshallingTests.boolean_return_false()
- Everything.test_simple_callback(badcallback())
-
- try:
- Everything.test_simple_callback(callback)
- except ZeroDivisionError:
- pass
-
- def testReturnValueCallback(self):
- TestCallbacks.called = False
- def callback():
- TestCallbacks.called = True
- return 44
-
- self.assertEquals(Everything.test_callback(callback), 44)
- self.assertTrue(TestCallbacks.called)
-
- def testCallbackAsync(self):
- TestCallbacks.called = False
- def callback(foo):
- TestCallbacks.called = True
- return foo
-
- Everything.test_callback_async(callback, 44);
- i = Everything.test_callback_thaw_async();
- self.assertEquals(44, i);
- self.assertTrue(TestCallbacks.called)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]