コード例 #1
0
 def test_normal(self):
     wti = retries.FuzzyExponentialBackoff(0.3, 6.8, 8.5,
                                           90.1)._wait_time_iter
     self.assertAlmostEqual(wti.next(), 0.3)
     self.assertAlmostEqual(wti.next(), 0.3 * self.rand[0])
     self.assertAlmostEqual(wti.next(), 0.3 * self.rand[0] * self.rand[1])
     self.assertAlmostEqual(wti.next(), 90.1)
     self.assertRaises(StopIteration, wti.next)
コード例 #2
0
 def test_high_scale(self):
     wti = retries.FuzzyExponentialBackoff(2.0, 6.8, 8.5,
                                           3.0)._wait_time_iter
     self.assertAlmostEqual(wti.next(), 2.0)
     self.assertAlmostEqual(wti.next(), 3.0)
     self.assertRaises(StopIteration, wti.next)
コード例 #3
0
 def test_low_limit(self):
     wti = retries.FuzzyExponentialBackoff(0.3, 6.8, 8.5,
                                           0.0)._wait_time_iter
     self.assertAlmostEqual(wti.next(), 0.0)
     self.assertRaises(StopIteration, wti.next)