Ejemplo n.º 1
0
 def test_wait_class_backward_compatibility(self):
     """Ensure builtin objects accept both old and new parameters."""
     waitobj = tenacity.wait_fixed(5)
     self.assertEqual(waitobj(1, 0.1), 5)
     self.assertEqual(
         waitobj(1, 0.1, tenacity.Future.construct(1, 1, False)), 5)
     call_state = _make_wait_call_state(123, 456)
     self.assertEqual(call_state.attempt_number, 123)
     self.assertEqual(call_state.seconds_since_start, 456)
     self.assertEqual(waitobj(call_state=call_state), 5)
Ejemplo n.º 2
0
 def test_wait_func(self):
     r = Retrying(wait=lambda attempt, delay: attempt * delay)
     self.assertEqual(r.wait(_make_wait_call_state(1, 5)), 5)
     self.assertEqual(r.wait(_make_wait_call_state(2, 11)), 22)
     self.assertEqual(r.wait(_make_wait_call_state(10, 100)), 1000)