def test_clear(self): """Test that we can clear the whole cache content """ key = "key_size" value = "value_size" for index in xrange(cache_mod.CACHE_SIZE): cache_mod.set_key(key + str(index), value + str(index)) self.assertTrue(len(cache_mod.CACHE) == cache_mod.CACHE_SIZE, "Wrong size of cache in test_clear before clear") cache_mod.clear_keys() self.assertTrue(len(cache_mod.CACHE) == 0, "Wrong size of cleared cache in test_clear after clear")
def test_clear(self): """Test that we can clear the whole cache content """ key = "key_size" value = "value_size" for index in xrange(cache_mod.CACHE_SIZE): cache_mod.set_key(key + str(index), value + str(index)) self.assertTrue( len(cache_mod.CACHE) == cache_mod.CACHE_SIZE, "Wrong size of cache in test_clear before clear") cache_mod.clear_keys() self.assertTrue( len(cache_mod.CACHE) == 0, "Wrong size of cleared cache in test_clear after clear")
def setUp(self): """Setup: ensure cache is empty before each test """ cache_mod.clear_keys()