code: def test_X_types_and_transformed_shapes(valid_df):
      def expect_value_error(X, X_transform=None):
          if X_transform is None:
              X_transform = X
          with pytest.raises(ValueError):
              capper = ColumnCapper().fit(X)
              capper.transform(X_transform)
  
      # Fitted and transformed arrays must have the same number of columns
      expect_value_error(valid_df, valid_df[["a", "b"]])
  
      invalid_dfs = [
          pd.DataFrame(
              {"a": [np.nan, np.nan, np.nan], "b": [11, 12, 13]}
          ),
          pd.DataFrame(
              {"a": [np.inf, np.inf, np.inf], "b": [11, 12, 13]}
          ),
      ]
  
      for invalid_df in invalid_dfs:
          expect_value_error(
              invalid_df
          )  # contains an invalid column ('a')
          expect_value_error(
              invalid_df["b"]
          )  # 1d arrays should be reshaped before fitted/transformed
          # Like this:
          ColumnCapper().fit_transform(
              invalid_df["b"].values.reshape(-1, 1)
          )
          ColumnCapper().fit_transform(
              invalid_df["b"].values.reshape(1, -1)
          )
  
      capper = ColumnCapper()
      for X in valid_df, valid_df.values:
          assert capper.fit_transform(X).shape == X.shape
  
file_path: scikit-lego/tests/test_preprocessing/test_columncapper.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.utils.validation import FLOAT_DTYPES
  from sklego.common import flatten
  from sklego.preprocessing import ColumnCapper
  from tests.conftest import general_checks, nonmeta_checks, select_tests, transformer_checks
label_desc: Use image node_id 5 for calling a global function with example usage: test_X_types_and_transformed_shapes(valid_df) without return types