code: def test_nonzero_numerical_imputation(format_type):
      # First try with an array with 0 as only valid category. The imputation should
      # happen with -1
      X = np.full(fill_value=np.nan, shape=(10, 10))
      X[0, :] = 0
      if "pandas" in format_type:
          X = pd.DataFrame(X)
      elif "numpy" in format_type:
          pass
      else:
          pytest.fail(format_type)
      Y = CategoricalImputation().fit_transform(X.copy())
      np.testing.assert_equal(np.nan_to_num(X, nan=-1, copy=True), Y)
  
      # Then if there is also a -1 in the category, we expect -2 as imputation
      X = np.full(fill_value=np.nan, shape=(10, 10))
      X[0, :] = 0
      X[1, :] = -1
      if "pandas" in format_type:
          X = pd.DataFrame(X)
      Y = CategoricalImputation().fit_transform(X.copy())
      np.testing.assert_equal(np.nan_to_num(X, nan=-2, copy=True), Y)
  
file_path: auto-sklearn/test/test_pipeline/components/data_preprocessing/test_categorical_imputation.py
imports: import numpy
  import pandas
  from scipy import sparse
  from autosklearn.pipeline.components.data_preprocessing.imputation.categorical_imputation import CategoricalImputation
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_nonzero_numerical_imputation(format_type) without return types