def test_clear(self): on_evict = MagicMock() c = LRUCache(3, on_evict) c[0] = 'a' c[1] = 'b' c[2] = 'c' c.clear() self._check_order([], c) assert_eq(3, on_evict.call_count) assert_eq([call(0, 'a'), call(1, 'b'), call(2, 'c')], on_evict.call_args_list)
def test_clear(self): on_evict = MagicMock() c = LRUCache(3, on_evict) c[0] = "a" c[1] = "b" c[2] = "c" c.clear() self._check_order([], c) assert_eq(3, on_evict.call_count) assert_eq([call(0, "a"), call(1, "b"), call(2, "c")], on_evict.call_args_list)