示例#1
0
    def testCallback(self):
        TestCallbacks.called = False

        def callback():
            TestCallbacks.called = True

        Everything.test_simple_callback(callback)
        self.assertTrue(TestCallbacks.called)
示例#2
0
    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
示例#3
0
    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
示例#4
0
 def callback():
     GIMarshallingTests.boolean_return_true()
     GIMarshallingTests.boolean_return_false()
     Everything.test_simple_callback(badcallback())