Esempio n. 1
0
def test_ttl():
    ledis = Ledis()
    ledis.set("str_type", "hello")
    assert ledis.storage["str_type"].expire_at is None

    ledis.expire("str_type", 10)
    assert ledis.ttl("str_type") == 10
Esempio n. 2
0
def test_ttl_not_set():
    ledis = Ledis()
    ledis.set("str_type", "hello")
    assert ledis.storage["str_type"].expire_at is None
    assert ledis.ttl("str_type") == -1
Esempio n. 3
0
def test_ttl_key_not_exist():
    ledis = Ledis()
    assert ledis.ttl("str_type") == -2