Esempio n. 1
0
    def test_storing_safely_1 (self):
        test = NotifyTestObject ()

        variable       = Variable ()
        variable.value = 100

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

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

            variable.value = 400

        variable.value = 500

        test.assert_results (100, 200, 300, 400)
Esempio n. 2
0
    def test_storing_safely_1(self):
        test = NotifyTestObject()

        variable = Variable()
        variable.value = 100

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

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

            variable.value = 400

        variable.value = 500

        test.assert_results(100, 200, 300, 400)
Esempio n. 3
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)
Esempio n. 4
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)