summary refs log tree commit diff
path: root/tests/util
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-01-22 12:18:14 +0000
committerDavid Baker <dave@matrix.org>2016-01-22 12:18:14 +0000
commitd552861346d6f2f3d50fa0aff3e239d17cf9b7c0 (patch)
tree4cd93b237f60276f5a9735c365b5d80c3f1df47e /tests/util
parentMake LRU cache not default to treecache & add options to use it (diff)
downloadsynapse-d552861346d6f2f3d50fa0aff3e239d17cf9b7c0.tar.xz
Revert all the bits changing keys of eeverything that used LRUCaches to tuples
Diffstat (limited to '')
-rw-r--r--tests/util/test_lrucache.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/util/test_lrucache.py b/tests/util/test_lrucache.py
index bcad1d4258..2cd3d26454 100644
--- a/tests/util/test_lrucache.py
+++ b/tests/util/test_lrucache.py
@@ -22,37 +22,37 @@ from synapse.util.caches.treecache import TreeCache
 class LruCacheTestCase(unittest.TestCase):
 
     def test_get_set(self):
-        cache = LruCache(1, 1)
-        cache[("key",)] = "value"
-        self.assertEquals(cache.get(("key",)), "value")
-        self.assertEquals(cache[("key",)], "value")
+        cache = LruCache(1)
+        cache["key"] = "value"
+        self.assertEquals(cache.get("key"), "value")
+        self.assertEquals(cache["key"], "value")
 
     def test_eviction(self):
-        cache = LruCache(2, 1)
-        cache[(1,)] = 1
-        cache[(2,)] = 2
+        cache = LruCache(2)
+        cache[1] = 1
+        cache[2] = 2
 
-        self.assertEquals(cache.get((1,)), 1)
-        self.assertEquals(cache.get((2,)), 2)
+        self.assertEquals(cache.get(1), 1)
+        self.assertEquals(cache.get(2), 2)
 
-        cache[(3,)] = 3
+        cache[3] = 3
 
-        self.assertEquals(cache.get((1,)), None)
-        self.assertEquals(cache.get((2,)), 2)
-        self.assertEquals(cache.get((3,)), 3)
+        self.assertEquals(cache.get(1), None)
+        self.assertEquals(cache.get(2), 2)
+        self.assertEquals(cache.get(3), 3)
 
     def test_setdefault(self):
-        cache = LruCache(1, 1)
-        self.assertEquals(cache.setdefault(("key",), 1), 1)
-        self.assertEquals(cache.get(("key",)), 1)
-        self.assertEquals(cache.setdefault(("key",), 2), 1)
-        self.assertEquals(cache.get(("key",)), 1)
+        cache = LruCache(1)
+        self.assertEquals(cache.setdefault("key", 1), 1)
+        self.assertEquals(cache.get("key"), 1)
+        self.assertEquals(cache.setdefault("key", 2), 1)
+        self.assertEquals(cache.get("key"), 1)
 
     def test_pop(self):
-        cache = LruCache(1, 1)
-        cache[("key",)] = 1
-        self.assertEquals(cache.pop(("key",)), 1)
-        self.assertEquals(cache.pop(("key",)), None)
+        cache = LruCache(1)
+        cache["key"] = 1
+        self.assertEquals(cache.pop("key"), 1)
+        self.assertEquals(cache.pop("key"), None)
 
     def test_del_multi(self):
         cache = LruCache(4, 2, cache_type=TreeCache)