code: def test_data_validation_for_classification(openmlid, as_frame):
      x, y = sklearn.datasets.fetch_openml(
          data_id=openmlid, return_X_y=True, as_frame=as_frame
      )
      validator = InputValidator(is_classification=True)
  
      if as_frame:
          # NaN is not supported in categories, so
          # drop columns with them.
          nan_cols = [i for i in x.columns if x[i].isnull().any()]
          cat_cols = [
              i
              for i in x.columns
              if x[i].dtype.name in ["category", "bool"]
          ]
          unsupported_columns = list(set(nan_cols) & set(cat_cols))
          if len(unsupported_columns) > 0:
              x.drop(unsupported_columns, axis=1, inplace=True)
  
      (
          X_train,
          X_test,
          y_train,
          y_test,
      ) = sklearn.model_selection.train_test_split(
          x, y, test_size=0.33, random_state=0
      )
  
      validator.fit(
          X_train=X_train, y_train=y_train, X_test=X_test, y_test=y_test
      )
  
      X_train_t, y_train_t = validator.transform(X_train, y_train)
      assert np.shape(X_train) == np.shape(X_train_t)
  
      # Leave columns that are complete NaN
      # The sklearn pipeline will handle that
      if as_frame and np.any(pd.isnull(X_train).values.all(axis=0)):
          assert np.any(pd.isnull(X_train_t).values.all(axis=0))
      elif not as_frame and np.any(pd.isnull(X_train).all(axis=0)):
          assert np.any(pd.isnull(X_train_t).all(axis=0))
  
      # make sure everything was encoded to number
      assert np.issubdtype(y_train_t.dtype, np.number)
  
      # Make sure we created a feat type
      validator.feature_validator.feat_type is not None
  
file_path: auto-sklearn/test/test_data/test_validation.py
imports: import numpy
  import pandas
  import sklearn.datasets
  import sklearn.model_selection
  from scipy import sparse
  from autosklearn.data.validation import InputValidator
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_data_validation_for_classification(openmlid, as_frame) without return types