code: def test_cache_mixin_wrong_dirs():
      # Test the memory cache raises a ValueError when input base path doesn't
      # exist.
  
      for cache_dir in (
          "/bad_dir/cache",
          "~/nilearn_data/tmp/test_cache",
      ):
          expand_cache_dir = os.path.expanduser(cache_dir)
          mixin_mock = CacheMixinTest(cache_dir)
  
          try:
              with pytest.raises(
                  ValueError,
                  match="Given cache path parent directory doesn't",
              ):
                  mixin_mock.run()
              assert not os.path.exists(expand_cache_dir)
          finally:
              if os.path.exists(expand_cache_dir):
                  shutil.rmtree(expand_cache_dir)
  
file_path: nilearn/nilearn/_utils/tests/test_cache_mixin.py
imports: import os
  import shutil
  from pathlib import Path
  import pytest
  from joblib import Memory
  import nilearn
  from nilearn._utils import CacheMixin, cache_mixin
label_desc: Use image node_id 6 for calling a global function with example usage: test_cache_mixin_wrong_dirs() without return types