def test_constant(self): '''We add the constant value''' base = 5 four = backoff.Exponential(base, c=4) zero = backoff.Exponential(base) for i in range(10): self.assertEqual(zero.backoff(i) + 4, four.backoff(i))
def test_factor(self): '''We make use of the constant factor''' base = 5 one = backoff.Exponential(base, 1) two = backoff.Exponential(base, 2) for i in range(10): self.assertEqual(one.backoff(i) * 2, two.backoff(i))
def test_base(self): '''We honor the base''' one = backoff.Exponential(1) two = backoff.Exponential(2) self.assertEqual(one.backoff(1) * 2, two.backoff(1)) self.assertEqual(one.backoff(2) * 4, two.backoff(2))