Example #1
0
    def test_thaw_not_suppress_exception_raise_exception(self):
        test_future = Future("TestData")

        def test_method():
            return True

        test_future.freeze(
            test_method, "arg1", "arg2", kwarg1="test", kwarg2="test")

        with pytest.raises(TypeError):
            test_future.thaw(False)

        assert test_future.res is None
        assert test_future.evt.is_set() is False
Example #2
0
    def test_thaw_not_suppress_exception_raise_exception(self):
        test_future = Future("TestData")

        def test_method():
            return True

        test_future.freeze(test_method,
                           "arg1",
                           "arg2",
                           kwarg1="test",
                           kwarg2="test")

        with pytest.raises(TypeError):
            test_future.thaw(False)

        assert test_future.res is None
        assert test_future.evt.is_set() is False
Example #3
0
    def test_thaw_suppress_exception_no_exception(self):
        test_future = Future("TestData")

        def test_method(*args, **kwargs):
            return True

        test_future.freeze(test_method)

        expected = True
        actual = test_future.thaw()
        assert expected == actual

        assert test_future.res is True
        assert test_future.evt.is_set() is True
Example #4
0
    def test_thaw_not_suppress_exception_no_exception(self):
        test_future = Future("TestData")

        def test_method(*args, **kwargs):
            return True

        test_future.freeze(test_method)

        expected = True
        actual = test_future.thaw(False)
        assert expected == actual

        assert test_future.res == True
        assert test_future.evt.isSet() == True
Example #5
0
    def test_thaw_suppress_exception_exception(self):
        test_future = Future("TestData")

        def test_method():
            return True

        test_future.freeze(
            test_method, "arg1", "arg2", kwarg1="test", kwarg2="test")

        test_result = test_future.thaw()

        assert isinstance(test_result, TypeError)

        assert isinstance(test_future.res, TypeError)
        assert test_future.evt.isSet() == True