def test_retry_timeout():
    def failing():
        raise MyError

    # sleep only between tries, so retry is 11, but sleep summary is ~0.1 sec
    start_time = time()
    with pytest.raises(MyError): retry(11, MyError, timeout=0.01)(failing)()
    assert time() - start_time < 0.11 < 0.1

    # exponential timeout
    start_time = time()
    with pytest.raises(MyError): retry(4, MyError, timeout=lambda a: 0.01 * 2 ** a)(failing)()
    d = time() - start_time
    assert 0.07 < d < 0.08
dataset/ETHPy150Open Suor/funcy/tests/test_flow.py/test_retry_timeout/swapped operands of `<`