code: def test_transform_all_formats(
      create_dummy_preprocessors, dataset_format
  ):
      (
          with_nothing,
          with_pandas,
          with_numpy,
          with_pandas_and_numpy,
          with_pandas_and_numpy_preferred,
      ) = create_dummy_preprocessors
  
      if dataset_format == "simple":
          ds = ray.data.range(10)
      elif dataset_format == "pandas":
          df = pd.DataFrame(
              [[1, 2, 3], [4, 5, 6]], columns=["A", "B", "C"]
          )
          ds = ray.data.from_pandas(df)
      elif dataset_format == "arrow":
          df = pd.DataFrame(
              [[1, 2, 3], [4, 5, 6]], columns=["A", "B", "C"]
          )
          ds = ray.data.from_arrow(pyarrow.Table.from_pandas(df))
      else:
          raise ValueError(
              f"Untested dataset_format configuration: {dataset_format}."
          )
  
      with pytest.raises(NotImplementedError):
          with_nothing.transform(ds)
  
      patcher = patch.object(ray.data.dataset.Dataset, "map_batches")
  
      with patcher as mock_map_batches:
          with_pandas.transform(ds)
          mock_map_batches.assert_called_once_with(
              with_pandas._transform_pandas,
              batch_format=BatchFormat.PANDAS,
          )
  
      with patcher as mock_map_batches:
          with_numpy.transform(ds)
          mock_map_batches.assert_called_once_with(
              with_numpy._transform_numpy,
              batch_format=BatchFormat.NUMPY,
          )
  
      # Pandas preferred by default.
      with patcher as mock_map_batches:
          with_pandas_and_numpy.transform(ds)
      mock_map_batches.assert_called_once_with(
          with_pandas_and_numpy._transform_pandas,
          batch_format=BatchFormat.PANDAS,
      )
  
      with patcher as mock_map_batches:
          with_pandas_and_numpy_preferred.transform(ds)
      mock_map_batches.assert_called_once_with(
          with_pandas_and_numpy_preferred._transform_numpy,
          batch_format=BatchFormat.NUMPY,
      )
  
imports: import re
  import warnings
  from typing import Dict, Union
  from unittest.mock import patch
  import numpy
  import pandas
  import pyarrow
  import pytest
  import ray
  from ray.air.constants import MAX_REPR_LENGTH
  from ray.air.util.data_batch_conversion import BatchFormat
  from ray.data.preprocessor import Preprocessor
  from ray.data.preprocessors import BatchMapper, Categorizer, Chain, Concatenator, CountVectorizer, FeatureHasher, HashingVectorizer, LabelEncoder, MaxAbsScaler, MinMaxScaler, MultiHotEncoder, Normalizer, OneHotEncoder, OrdinalEncoder, PowerTransformer, RobustScaler, SimpleImputer, StandardScaler, Tokenizer
label_desc: Use image node_id 7 for calling a global function with example usage: test_transform_all_formats(create_dummy_preprocessors, dataset_format) without return types