code: def test_prefetch_blocks(num_blocks_to_prefetch):
      class DummyPrefetcher(BlockPrefetcher):
          def __init__(self):
              self.windows = []
  
          def prefetch_blocks(self, blocks: List[Block]):
              self.windows.append(blocks)
  
      num_blocks = 10
      prefetcher = DummyPrefetcher()
      block_iter = block_generator(num_rows=1, num_blocks=num_blocks)
      prefetch_block_iter = _prefetch_blocks(
          block_iter,
          prefetcher=prefetcher,
          num_blocks_to_prefetch=num_blocks_to_prefetch,
      )
  
      block_count = 1
      for _ in prefetch_block_iter:
          block_count += 1
          if block_count < num_blocks:
              # Test that we are actually prefetching.
              assert len(prefetcher.windows) == block_count
  
      windows = prefetcher.windows
      assert all(
          len(window) == num_blocks_to_prefetch for window in windows
      )
  
file_path: ray/python/ray/data/tests/block_batching/test_block_batching.py
imports: from typing import List
  from unittest import mock
  import pyarrow
  import pytest
  from ray.data._internal.block_batching.block_batching import BlockPrefetcher, _prefetch_blocks, batch_block_refs, batch_blocks
  from ray.data.block import Block
label_desc: Use image node_id 4 for calling a global function with example usage: test_prefetch_blocks(num_blocks_to_prefetch) without return types