def test_clear(Cache, obj_infos): """The clear method empties the cache.""" cache = Cache(5) for obj_info in obj_infos: cache.add(obj_info) cache.clear() assert cache.get_cached() == [] # Just an additional check ensuring that any additional structures # which may be used were cleaned properly as well. for obj_info in obj_infos: assert not cache.remove(obj_info)