'Replacing an object should cleanup the old value.'

def test_cleanup_on_replace(self):

    cleanup_called = []
    def cleanup_func(key, val):
        cleanup_called.append((key, val))
    cache = lru_cache.LRUCache(max_cache=2)
    cache.add(1, 10, cleanup=cleanup_func)
    cache.add(2, 20, cleanup=cleanup_func)
    cache.add(2, 25, cleanup=cleanup_func)
    self.assertEqual([(2, 20)], cleanup_called)
    self.assertEqual(25, cache[2])
    cache[2] = 26
    self.assertEqual([(2, 20), (2, 25)], cleanup_called)
