code: def test_transform_encoder():
      """Test transform method of Categorical_encoder class."""
      df = pd.read_csv("data_for_tests/train.csv")
      encoder = Categorical_encoder()
      with pytest.raises(ValueError):
          encoder.transform(df)
      encoder.fit(df, df["Survived"])
      df_encoded = encoder.transform(df)
      assert (df.columns == df_encoded.columns).all()
      encoder.set_params(strategy="dummification")
      encoder.fit(df, df["Survived"])
      df_encoded = encoder.transform(df)
      assert (type(df_encoded) == pd.SparseDataFrame) | (
          type(df_encoded) == pd.DataFrame
      )
      encoder.set_params(strategy="random_projection")
      encoder.fit(df, df["Survived"])
      df_encoded = encoder.transform(df)
      assert type(df_encoded) == pd.DataFrame
      encoder.set_params(strategy="entity_embedding")
      encoder.fit(df, df["Survived"])
      df_encoded = encoder.transform(df)
      assert type(df_encoded) == pd.DataFrame
  
file_path: MLBox/tests/test_categorical_encoder.py
imports: import pytest
  import pandas
  from mlbox.encoding.categorical_encoder import Categorical_encoder
label_desc: Use image node_id 5 for calling a global function with example usage: test_transform_encoder() without return types