def test_past_unsafe_input_datetime(): t = Timeout( datetime.datetime.fromisoformat(FREEZE_DATE) - datetime.timedelta(days=1), past_safe=False, ) assert t.is_expired()
def test_reset_and_set(): t = Timeout(10000) assert not t.is_expired() t.reset(5000) assert t.is_expired()
def test_past_unsafe_input_int(): t = Timeout(-1000, past_safe=False) assert t.is_expired()
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()
def test_expired_input_int(): t = Timeout(10000) assert not t.is_expired() assert t.is_expired()
def test_is_expired_type(timeout): t = Timeout(timeout) assert isinstance(t.is_expired(), bool)