From 31a051b6771bf720c78246bd6c8875d219ddbc88 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 22 Jan 2016 11:22:00 +0000 Subject: Test treecache directly --- tests/util/test_lrucache.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/util') diff --git a/tests/util/test_lrucache.py b/tests/util/test_lrucache.py index 80c19b944a..fca2e98983 100644 --- a/tests/util/test_lrucache.py +++ b/tests/util/test_lrucache.py @@ -52,3 +52,22 @@ class LruCacheTestCase(unittest.TestCase): 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[("animal", "cat")] = "mew" + cache[("animal", "dog")] = "woof" + cache[("vehicles", "car")] = "vroom" + cache[("vehicles", "train")] = "chuff" + + self.assertEquals(len(cache), 4) + + self.assertEquals(cache.get(("animal", "cat")), "mew") + self.assertEquals(cache.get(("vehicles", "car")), "vroom") + cache.del_multi(("animal",)) + self.assertEquals(len(cache), 2) + self.assertEquals(cache.get(("animal", "cat")), None) + self.assertEquals(cache.get(("animal", "dog")), None) + self.assertEquals(cache.get(("vehicles", "car")), "vroom") + self.assertEquals(cache.get(("vehicles", "train")), "chuff") + # Man from del_multi say "Yes". -- cgit 1.4.1