Esempio n. 1
0
    def test_cant_mutate_queue(self):
        r = Client()
        r.set("jo", [42, 43])
        assert r.get("jo") == [42, 43]
        with self.assertRaises(Exception) as context:
            r.rpush("jo", 44)

        with self.assertRaises(Exception) as context:
            r.lpush("jo", 44)

        with self.assertRaises(Exception) as context:
            r.rpop("jo")

        with self.assertRaises(Exception) as context:
            l.rpop("jo")
Esempio n. 2
0
 def test_queues(self):
     r = Client()
     r.delete("ll")
     assert r.rpush("ll", 42) == 1
     assert r.rpush("ll", 43) == 2
     assert r.lpush("ll", 41) == 3
     assert r.get("ll") == [41, 42, 43]
     assert r.rpop("ll") == 43
     assert r.lpop("ll") == 41
     assert r.get("ll") == [42]
     assert r.lpop("ll") == 42
     assert r.get("ll") == None
     assert r.lpop("ll") == None
     assert r.rpop("ll") == None