Exemple #1
0
    def test_single(self):
        cache = self._cache()

        for key, value in self.data.items():
            self.assertEqual(cache.get(key), None)
            cache.set(key, value)
            self.assertEqual(cache.get(key), value)
            cache.delete(key)
            self.assertEqual(cache.get(key), None)
Exemple #2
0
    def test_multi(self):
        cache = self._cache()
        keys = self.data.keys()

        for key, value in self.data.items():
            cache.delete(key)

        cache.set_multi(self.data)
        self.assertEqual(cache.get_multi(keys), self.data)

        cache.delete_multi(keys)
        deleted = cache.get_multi(keys)
        for key, value in deleted.items():
            self.assertEqual(value, None)