Exemple #1
0
    def test_storing_safely_2 (self):
        test = NotifyTestObject ()

        variable       = Variable ()
        variable.value = 100

        with nested (ignoring_exceptions (), variable.storing_safely (test.simple_handler)):
            variable.value = 200

            with nested (ignoring_exceptions (), variable.storing_safely (test.simple_handler)):
                variable.value = 300

            variable.value = 400
            raise Exception

        variable.value = 500

        test.assert_results (100, 200, 300, 400)
Exemple #2
0
    def test_storing_safely_2(self):
        test = NotifyTestObject()

        variable = Variable()
        variable.value = 100

        with nested(ignoring_exceptions(),
                    variable.storing_safely(test.simple_handler)):
            variable.value = 200

            with nested(ignoring_exceptions(),
                        variable.storing_safely(test.simple_handler)):
                variable.value = 300

            variable.value = 400
            raise Exception

        variable.value = 500

        test.assert_results(100, 200, 300, 400)
Exemple #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)
Exemple #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)
Exemple #5
0
    def test_synchronizing_2 (self):
        test = NotifyTestObject ()

        variable1       = Variable ()
        variable2       = Variable ()

        variable1.value = 100
        variable2.value = 200

        variable1.changed.connect (test.simple_handler)

        with nested (ignoring_exceptions (), variable1.synchronizing (variable2)):
            variable2.value = 300
            raise Exception

        variable2.value = 400

        test.assert_results (200, 300)
Exemple #6
0
    def test_synchronizing_2(self):
        test = NotifyTestObject()

        variable1 = Variable()
        variable2 = Variable()

        variable1.value = 100
        variable2.value = 200

        variable1.changed.connect(test.simple_handler)

        with nested(ignoring_exceptions(), variable1.synchronizing(variable2)):
            variable2.value = 300
            raise Exception

        variable2.value = 400

        test.assert_results(200, 300)