code: def test_fit_performs_dataset_compression(
      X_type: Any,
      y_type: Any,
      make_automl: Callable[..., AutoML],
      make_data: Callable[..., Any],
  ) -> None:
      """
      Parameters
      ----------
      mock_reduce_dataset: MagicMock
          A mock function to view call
  
      X_type: Union[np.ndarray, csr_matrix, list, pd.Dataframe]
          Feature to reduce
  
      y_type: Union[np.ndarray, csr_matrix, list, pd.Series, pd.Dataframe]
          Target to reduce (regression values)
  
      Fixtures
      --------
      make_automl: Callable[..., AutoML]
          Factory to make automl instance
  
      make_data: Callable
          Factory to make data
  
      Expects
      -------
      * Should call reduce_dataset_size_if_too_large
  
      # TODO not sure how to keep function behaviour and just use the mock object so
      # that we can assert it was called.
      #
      # * `fit` will convert sparse `y`
      # * This gets passed to `reduce_dataset_size_if_too_large`
      # * The de-sparsified `y` is required for the datamanager later on
      #
      # Mocking away the functionality and just returning the X, y we see here will means
      # that the datamanager will get the sparse y and crash, hence we manually convert
      # here
      """
      X, y = make_data(types=(X_type, y_type))
  
      auto = make_automl(dataset_compression=True)
  
      with patch(
          "autosklearn.automl.reduce_dataset_size_if_too_large",
          return_value=(X, y),
      ) as mck:
          # To prevent fitting anything we use `only_return_configuration_space`
          auto.fit(
              X,
              y,
              only_return_configuration_space=True,
              task=BINARY_CLASSIFICATION,
          )
  
      assert mck.called
      del auto
  
file_path: auto-sklearn/test/test_automl/test_dataset_compression.py
imports: from typing import Any, Callable, Dict
  import numpy
  import pandas
  from scipy.sparse import csr_matrix
  from autosklearn.automl import AutoML
  from autosklearn.constants import BINARY_CLASSIFICATION
  from pytest_cases import parametrize
  from unittest.mock import patch
  from test.util import skip
label_desc: Use image node_id 2 for calling a global function with example usage: test_fit_performs_dataset_compression(X_type, y_type, make_automl, make_data) without return types