code: def test_try_create_cache_dir():
      with mock.patch.dict(os.environ, {}, clear=True):
          assert os.path.join(
              "chunks", "100b8cad7cf2a56f6df78f171f97a1ec", "0"
          ) in _try_create_cache_dir("any")
  
      # the cache dir creating at /cache requires root privileges, so we need to mock `os.makedirs()`
      with (
          mock.patch.dict(
              "os.environ",
              {
                  "LIGHTNING_CLUSTER_ID": "abc",
                  "LIGHTNING_CLOUD_PROJECT_ID": "123",
              },
          ),
          mock.patch(
              "lightning.data.streaming.dataset.os.makedirs"
          ) as makedirs_mock,
      ):
          cache_dir_1 = _try_create_cache_dir("")
          cache_dir_2 = _try_create_cache_dir("ssdf")
          assert cache_dir_1 != cache_dir_2
          assert cache_dir_1 == os.path.join(
              "/cache",
              "chunks",
              "d41d8cd98f00b204e9800998ecf8427e",
              "0",
          )
          assert len(makedirs_mock.mock_calls) == 2
  
          assert _try_create_cache_dir(
              "dir", shard_rank=0
          ) == os.path.join(
              "/cache",
              "chunks",
              "736007832d2167baaae763fd3a3f3cf1",
              "0",
          )
          assert _try_create_cache_dir(
              "dir", shard_rank=1
          ) == os.path.join(
              "/cache",
              "chunks",
              "736007832d2167baaae763fd3a3f3cf1",
              "1",
          )
          assert _try_create_cache_dir(
              "dir", shard_rank=2
          ) == os.path.join(
              "/cache",
              "chunks",
              "736007832d2167baaae763fd3a3f3cf1",
              "2",
          )
  
imports: import os
  import sys
  from time import sleep
  from unittest import mock
  import numpy
  import pytest
  import torch
  from lightning import seed_everything
  from lightning.data.streaming import Cache, functions
  from lightning.data.streaming.dataloader import StreamingDataLoader
  from lightning.data.streaming.dataset import _INDEX_FILENAME, Dir, RemoteDir, StreamingDataset, _associate_chunks_to_workers, _replay_chunks_sampling, _replay_sampling, _should_replace_path, _try_create_cache_dir
  from lightning.data.streaming.item_loader import TokensLoader
  from lightning.data.streaming.shuffle import FullShuffle, NoShuffle
  from lightning.data.utilities.env import Environment, _DistributedEnv, _WorkerEnv
  from torch.utils.data import DataLoader
label_desc: Use image node_id 8 for calling a global function with example usage: test_try_create_cache_dir() without return types