Exemplo n.º 1
0
    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"))
Exemplo n.º 2
0
    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)