diff options
author | Zach Goldberg <zach@zachgoldberg.com> | 2010-04-17 12:56:19 -0400 |
---|---|---|
committer | Zach Goldberg <zach@zachgoldberg.com> | 2010-04-18 11:21:12 -0400 |
commit | 7d533b8893bc4a8a82fd9708278fa1dce5d3551e (patch) | |
tree | 38fbd268211295f91400060eb82ef1728a0280ac | |
parent | a90298cc9e6c0f336f887a71d80b1efd07ec2811 (diff) | |
download | pygi-7d533b8893bc4a8a82fd9708278fa1dce5d3551e.tar.gz pygi-7d533b8893bc4a8a82fd9708278fa1dce5d3551e.tar.xz pygi-7d533b8893bc4a8a82fd9708278fa1dce5d3551e.zip |
Move some tests from test_gi to test_everything
-rw-r--r-- | tests/test_everything.py | 60 | ||||
-rw-r--r-- | 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) |