code: def test_combined_dataset_num_samples_yield():
      dataset = CombinedStreamingDataset(
          [range(10), range(0, -10, -1)], 42, weights=(0.5, 0.5)
      )
      dataset_iter = iter(dataset)
  
      data = list(dataset_iter)
      assert data == [
          0,
          0,
          1,
          2,
          -1,
          -2,
          -3,
          3,
          4,
          5,
          6,
          -4,
          7,
          8,
          -5,
          -6,
          9,
          -7,
          -8,
      ]
  
      dataset = CombinedStreamingDataset(
          [range(10), range(0, -10, -1)], 37, weights=(0.5, 0.5)
      )
      dataset_iter = iter(dataset)
  
      data = list(dataset_iter)
      assert data == [
          0,
          0,
          -1,
          -2,
          -3,
          -4,
          -5,
          1,
          -6,
          2,
          -7,
          -8,
          3,
          4,
          -9,
          5,
      ]
  
      dataset = CombinedStreamingDataset(
          [range(10), range(0, -10, -1)], 23, weights=(0.5, 0.5)
      )
      dataset_iter = iter(dataset)
  
      data = [next(dataset_iter) for _ in range(5)]
      assert data == [0, -1, -2, 0, -3]
      assert dataset._iterator._num_samples_yielded == [1, 4]
      assert next(dataset_iter) == 1
      assert dataset._iterator._num_samples_yielded == [2, 4]
  
file_path: pytorch-lightning/tests/tests_data/streaming/test_combined.py
imports: import pytest
  from lightning.data.streaming.combined import CombinedStreamingDataset
  from torch.utils.data import IterableDataset
label_desc: Use image node_id 1 for calling a global function with example usage: test_combined_dataset_num_samples_yield() without return types