示例#1
0
    def test_connecting_safely_1(self):
        test = NotifyTestObject()
        signal = Signal()

        signal.emit(1)

        with signal.connecting_safely(test.simple_handler):
            signal.emit(2)

            with signal.connecting_safely(test.simple_handler):
                signal.emit(3)

            signal.emit(4)

        signal.emit(5)

        test.assert_results(2, 3, 4)
示例#2
0
    def test_connecting_safely_1 (self):
        test   = NotifyTestObject ()
        signal = Signal ()

        signal.emit (1)

        with signal.connecting_safely (test.simple_handler):
            signal.emit (2)

            with signal.connecting_safely (test.simple_handler):
                signal.emit (3)

            signal.emit (4)

        signal.emit (5)

        test.assert_results (2, 3, 4)
示例#3
0
    def test_connecting_safely_2 (self):
        test   = NotifyTestObject ()
        signal = Signal ()

        signal.emit (1)

        with nested (ignoring_exceptions (), signal.connecting_safely (test.simple_handler)):
            signal.emit (2)
            raise Exception

        signal.emit (3)

        test.assert_results (2)
示例#4
0
    def test_connecting_safely_2(self):
        test = NotifyTestObject()
        signal = Signal()

        signal.emit(1)

        with nested(ignoring_exceptions(),
                    signal.connecting_safely(test.simple_handler)):
            signal.emit(2)
            raise Exception

        signal.emit(3)

        test.assert_results(2)