def test_promoteFromHead(self): lru = LRUCache(3) for d in ['A', 'B', 'C', 'A']: lru.get(d) self.assertEqual(lru.getCacheState(), ['A', 'C', 'B'])
def test_capacity(self): lru = LRUCache(3) for d in ['A', 'B', 'C', 'D', 'E', 'F', 'G']: lru.get(d) self.assertEqual(lru.getCacheState(), ['G', 'F', 'E'])