Exemple #1
0
    def test_partial_function_on_return(self):
        def lt(x, y):
            return x < y

        f = functools.partial(lt, y=5)
        demo = RetryDemo()
        assert_that(retry(demo.call, on_return=f)(), equal_to(5))
 def decorator(self, url, **kwargs):
     wrapped = retry(on_error=self._http_authentication_error,
                     on_retry=self._update_csrf_token)(func)
     return wrapped(self, url, **kwargs)
Exemple #3
0
 def decorator(self, url, **kwargs):
     wrapped = retry(on_error=self._http_authentication_error,
                     on_retry=self._update_csrf_token)(func)
     return wrapped(self, url, **kwargs)
Exemple #4
0
 def test_functional_on_return(self):
     demo = RetryDemo()
     assert_that(retry(demo.call, on_return=lambda x: x < 5)(), equal_to(5))
Exemple #5
0
 def test_functional_limit(self):
     demo = RetryDemo()
     assert_that(retry(demo.call, limit=3)(), equal_to(3))