def test_delete_updates_length(self): """ Updates the correct length of the cache """ cache = LRUCache(10) cache.add_value(1) before_delete = cache.length() cache.delete_value(1) after_delete = cache.length() self.assertEqual(before_delete, 1) self.assertEqual(after_delete, 0)
def test_length_returns_0(self): """ Returns 0 if no values have been added """ cache = LRUCache(10) result = cache.length() self.assertEqual(result, 0)
def test_returns_correct_length(self): """ Returns the correct length of the cache if values have been added """ cache = LRUCache(1234) cache.add_value("1") cache.add_value("2") cache.add_value("3") result = cache.length() self.assertEqual(result, 3)