def test_delay_exponential_with_jitter():
    max_delay = 120.0
    get_delay = exceptions.DelayExponential(base=10,
                                            jitter=False,
                                            max_delay=max_delay)
    for i in range(10):
        assert get_delay(i) <= max_delay
Exemplo n.º 2
0
def test_delay_exponential_without_jitter():
    max_delay = 1200.0
    get_delay = exceptions.DelayExponential(base=5, jitter=False, max_delay=max_delay)
    results = [
        10.0,
        20.0,
        40.0,
        80.0,
        160.0,
        320.0,
        640.0,
        max_delay,  # rather than 1280.0
        max_delay,  # rather than 2560.0
    ]
    for i, result in enumerate(results, start=1):
        assert get_delay(i) == result