def test_try_incdec_method_with_bad_type(self): r = Client() r.set("kiki", "hello") with self.assertRaises(Exception) as context: r.incr("kiki") with self.assertRaises(Exception) as context: r.decr("kiki")
def test_cache2(self): r = Client() r.setex("kiki", 0.05, 42) assert r.incr("kiki", 6) == 48 assert r.get("kiki") == 48 time.sleep(0.05) assert r.get("kiki") == None
def test_cache3(self): r = Client() r.setex("kiki", 0.05, 42) assert r.incr("kiki", 6) == 48 assert "kiki" in r.keys() time.sleep(0.05) assert "kiki" not in r.keys()
def test_incdec(self): r = Client() r.delete("val") assert r.get("val") == None assert r.incr("val") == 1 assert r.get("val") == 1 assert r.incr("val") == 2 assert r.get("val") == 2 assert r.decr("val") == 1 assert r.get("val") == 1 r.delete("val") assert r.get("val") == None r.decr("val") assert r.get("val") == -1