code: def test_replay_chunks_sampling():
      chunks_replica = range(10)
      intervals_replica = [(i, i + 5) for i in range(0, 50, 5)]
      workers_chunks, workers_intervals = _associate_chunks_to_workers(
          2, _WorkerEnv(2, 0), chunks_replica, intervals_replica
      )
      assert workers_chunks == {0: [0, 2, 4, 6, 8], 1: [1, 3, 5, 7, 9]}
      assert workers_intervals == {
          0: [(0, 5), (10, 15), (20, 25), (30, 35), (40, 45)],
          1: [(5, 10), (15, 20), (25, 30), (35, 40), (45, 50)],
      }
      assert _replay_chunks_sampling(
          workers_intervals, {0: 16, 1: 11}
      ) == ({0: 3, 1: 2}, {0: 1, 1: 1})
      assert _replay_chunks_sampling(
          workers_intervals, {0: 14, 1: 13}
      ) == ({0: 2, 1: 2}, {0: 4, 1: 3})
      assert _replay_chunks_sampling(
          workers_intervals, {0: 15, 1: 12}
      ) == ({0: 3, 1: 2}, {0: 0, 1: 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 18 for calling a global function with example usage: test_replay_chunks_sampling() without return types