code: def test_variables_cast_as_category(df_enc_category_dtypes):
      df = df_enc_category_dtypes.copy()
      encoder = DecisionTreeEncoder(regression=False)
      encoder.fit(df[["var_A", "var_B"]], df["target"])
      X = encoder.transform(df[["var_A", "var_B"]])
  
      transf_df = df.copy()
      transf_df["var_A"] = [0.25] * 16 + [
          0.5
      ] * 4  # Tree: var_A <= 1.5 -> 0.25 else 0.5
      transf_df["var_B"] = [0.2] * 10 + [
          0.4
      ] * 10  # Tree: var_B <= 0.5 -> 0.2 else 0.4
      pd.testing.assert_frame_equal(
          X, transf_df[["var_A", "var_B"]], check_dtype=False
      )
      assert X["var_A"].dtypes == float
  
file_path: feature_engine/tests/test_encoding/test_decision_tree_encoder.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.exceptions import NotFittedError
  from feature_engine.encoding import DecisionTreeEncoder
label_desc: Use image node_id 9 for calling a global function with example usage: test_variables_cast_as_category(df_enc_category_dtypes) without return types