summary refs log tree commit diff
path: root/tests/util/test_lrucache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-29 11:53:55 +0000
committerErik Johnston <erik@matrix.org>2016-01-29 11:53:55 +0000
commit02a9c3be6c7cfd162a341cb167b7f3074e2b2a48 (patch)
tree6c64481a341329c3bc71249baf469956822c38bd /tests/util/test_lrucache.py
parentMerge pull request #537 from matrix-org/erikj/cache_filters (diff)
parentAdd tests (diff)
downloadsynapse-02a9c3be6c7cfd162a341cb167b7f3074e2b2a48.tar.xz
Merge pull request #538 from matrix-org/erikj/fix_lru_cache
Fix LruCache. Make TreeCache track its own size.
Diffstat (limited to 'tests/util/test_lrucache.py')
-rw-r--r--tests/util/test_lrucache.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/util/test_lrucache.py b/tests/util/test_lrucache.py
index 2cd3d26454..bab366fb7f 100644
--- a/tests/util/test_lrucache.py
+++ b/tests/util/test_lrucache.py
@@ -19,6 +19,7 @@ from .. import unittest
 from synapse.util.caches.lrucache import LruCache
 from synapse.util.caches.treecache import TreeCache
 
+
 class LruCacheTestCase(unittest.TestCase):
 
     def test_get_set(self):
@@ -72,3 +73,9 @@ class LruCacheTestCase(unittest.TestCase):
         self.assertEquals(cache.get(("vehicles", "car")), "vroom")
         self.assertEquals(cache.get(("vehicles", "train")), "chuff")
         # Man from del_multi say "Yes".
+
+    def test_clear(self):
+        cache = LruCache(1)
+        cache["key"] = 1
+        cache.clear()
+        self.assertEquals(len(cache), 0)