Пример #1
0
 def test_step_back_off(self):
     steps = [0.1, 0.2, 0.5, 1]
     strat = StepBackOffStrategy(steps=steps)
     for idx, step in enumerate(steps):
         self.assertEqual(strat.get_back_off(idx + 1), step)
     self.assertIsNone(strat.get_back_off(len(steps) + 1))
Пример #2
0
 def test_zero_back_off(self):
     strat = StepBackOffStrategy(steps=[0.1, 0.2, 0.5, 1])
     self.assertRaises(ValueError, lambda: strat.get_back_off(0))