Exemple #1
0
def test_past_unsafe_input_datetime():
    t = Timeout(
        datetime.datetime.fromisoformat(FREEZE_DATE) -
        datetime.timedelta(days=1),
        past_safe=False,
    )
    assert t.is_expired()
Exemple #2
0
def test_reset_and_set():
    t = Timeout(10000)
    assert not t.is_expired()
    t.reset(5000)
    assert t.is_expired()
Exemple #3
0
def test_past_unsafe_input_int():
    t = Timeout(-1000, past_safe=False)
    assert t.is_expired()
Exemple #4
0
def test_expired_input_datetime():
    t = Timeout(
        datetime.datetime.fromisoformat(FREEZE_DATE) +
        datetime.timedelta(seconds=10))
    assert not t.is_expired()
    assert t.is_expired()
Exemple #5
0
def test_expired_input_int():
    t = Timeout(10000)
    assert not t.is_expired()
    assert t.is_expired()
Exemple #6
0
def test_is_expired_type(timeout):
    t = Timeout(timeout)
    assert isinstance(t.is_expired(), bool)