def test_hashing_hit(self): c = LRUContainer(3) c.set("Spiderman", self.test_data["Spiderman"]) c.set("Batman", self.test_data["Batman"]) c.set("Superman", self.test_data["Superman"]) # Hits c.get("Batman") c.get("Spiderman") # superman should go out and not spiderman (First inser order) c.set("Iron man", self.test_data["Iron man"]) self.assertIsNone(c.get("Superman"))
def test_storing(self): c = LRUContainer(4) for k, v in self.test_data.items(): c.set(k, v) for k,v in self.test_data.items(): self.assertEqual(c.get(k), v)