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 callback(): GIMarshallingTests.boolean_return_true() GIMarshallingTests.boolean_return_false() Everything.test_simple_callback(badcallback())