Example #1
0
    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")
Example #2
0
    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