code: def test_cache(text_dir: Path):
      ds = load_dataset(str(text_dir))
      hash = Path(ds["train"].cache_files[0]["filename"]).parts[-2]
      cache = Cache(dataset_name=text_dir.name, hash=hash)
      reloaded = cache.as_dataset()
      assert list(ds) == list(reloaded)
      assert list(ds["train"]) == list(reloaded["train"])
  
file_path: datasets/tests/packaged_modules/test_cache.py
imports: from pathlib import Path
  import pytest
  from datasets import load_dataset
  from datasets.packaged_modules.cache.cache import Cache
label_desc: Use image node_id 1 for calling a global function with example usage: test_cache(text_dir) without return types