code: def test_batch_mapper_batch_size(ray_start_regular_shared, ds):
      """Tests BatcMapper batch size."""
  
      batch_size = 2
  
      def check_batch_size(batch):
          assert len(batch) == batch_size
          return batch
  
      batch_mapper = BatchMapper(
          fn=check_batch_size,
          batch_size=batch_size,
          batch_format="pandas",
      )
      batch_mapper.fit(ds)
      transformed_ds = batch_mapper.transform(ds)
      out_df = transformed_ds.to_pandas()
      expected_df = ds.to_pandas()
      assert_frame_equal(out_df, expected_df)
  
file_path: ray/python/ray/data/tests/preprocessors/test_batch_mapper.py
imports: from typing import Dict
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from pytest_lazyfixture import lazy_fixture
  import ray
  from ray.data.preprocessors import BatchMapper
  from ray.tests.conftest import *
label_desc: Use image node_id 3 for calling a global function with example usage: test_batch_mapper_batch_size(ray_start_regular_shared, ds) and returns: batch