code: def test_targetvalidator_supported_types_classification(
      input_data_targettest,
  ):
      y = input_data_targettest  # Just to remove visual clutter
  
      validator = TargetValidator(is_classification=True)
      validator.fit(y)
  
      y_encoded: np.ndarray = validator.transform(y)
      y_inverse: np.ndarray = validator.inverse_transform(y_encoded)
  
      # Assert the validator was fitted
      assert validator._is_fitted
  
      # Assert it returns y_inverse, y_encoded as ndarray
      assert isinstance(y_encoded, np.ndarray)
      assert isinstance(y_inverse, np.ndarray)
  
      # Assert that y_encoded is numeric and not boolean
      assert is_numeric_dtype(y_encoded.dtype) and not is_bool_dtype(
          y_encoded.dtype
      )
  
      # Assert dtype is presevered with y -> y_encoded -> y_inverse
      def dtype(arr):
          if isinstance(arr, list):
              if isinstance(arr[0], list):
                  return type(arr[0][0])
              else:
                  return type(arr[0])
          elif isinstance(arr, pd.DataFrame):
              return arr.dtypes[0]
          else:
              return arr.dtype
  
      if is_numeric_dtype(dtype(y)):
          assert y_inverse.dtype == dtype(y)
  
      # Assert that y == y_inverse, giving back the original values
      np.testing.assert_array_equal(y_inverse, np.array(y).reshape(-1))
  
      # Assert the y_inverse, y_encoded have the expected shape
      shape = np.shape(y)
      if len(shape) == 2 and shape[1] == 1:
          # For cases where y = [[1], [2], [3]],
          # we expect y_inverse, y_encodedd to have been flattened to [1,2,3]
          expected_shape = (shape[0],)
      else:
          expected_shape = shape
  
      assert y_encoded.shape == expected_shape
      assert y_inverse.shape == expected_shape
  
      # These next part of the tests rely on some encoding to have taken place
      # This happens when `is_classification` and not task_type = multilabel-indicator
      #
      # As state in TargetValidator._fit()
      # > Also, encoding multilabel indicator data makes the data multiclass
      #   Let the user employ a MultiLabelBinarizer if needed
      #
      # As a result of this, we don't encode 'multilabel-indicator' labels and
      # there is nothing else to check here
      if validator.type_of_target == "multilabel-indicator":
          assert validator.encoder is None
  
      else:
          assert validator.encoder is not None
  
          # Assert the columns have had their labels converted
          if y_encoded.ndim == 1:
              max_label = len(np.unique(y_encoded)) - 1
              assert np.min(y_encoded) == 0
              assert np.max(y_encoded) == max_label
  
          else:
              for col in range(y_encoded.shape[1]):
                  column = y_encoded[:, col]
                  max_label = len(np.unique(y_encoded[:, col])) - 1
                  assert np.min(column) == 0
                  assert np.max(column) == max_label
  
imports: import numpy
  import pandas
  import sklearn.datasets
  import sklearn.model_selection
  from pandas.api.types import is_bool_dtype, is_numeric_dtype
  from scipy import sparse
  from sklearn.utils.multiclass import type_of_target
  from autosklearn.data.target_validator import TargetValidator
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_targetvalidator_supported_types_classification(input_data_targettest) and returns: type, type, arr, arr