code: def test_given_categorical_data_when_fit_catboost_encoders_and_apply_catboost_encoding_then_returns_expected_feature_vector():
      X = np.array(["A", "B", "A", "D", "C", "C", "C", "A"])
      Y = np.array([1, 2, 3, 4, 2, 3, 4, 2])
  
      assert apply_catboost_encoding(
          X, fit_catboost_encoders(X, Y), Y
      ).reshape(-1) == approx(
          np.array(
              [
                  2.625,
                  2.625,
                  1.8125,
                  2.625,
                  2.625,
                  2.3125,
                  2.54166667,
                  2.20833333,
              ]
          )
      )
  
      assert apply_catboost_encoding(
          X, fit_catboost_encoders(X, Y)
      ).reshape(-1) == approx(
          np.array(
              [
                  2.15625,
                  2.625,
                  2.15625,
                  2.625,
                  2.90625,
                  2.90625,
                  2.90625,
                  2.15625,
              ]
          )
      )
  
      X = np.array(
          [
              ["A", 0],
              ["B", 1],
              ["A", 2],
              ["D", 3],
              ["C", 4],
              ["C", 5],
              ["C", 6],
              ["A", 7],
          ],
          dtype=object,
      )
  
      assert apply_catboost_encoding(
          X, fit_catboost_encoders(X, Y), Y
      ) == approx(
          np.array(
              [
                  [2.625, 0],
                  [2.625, 1],
                  [1.8125, 2],
                  [2.625, 3],
                  [2.625, 4],
                  [2.3125, 5],
                  [2.54166667, 6],
                  [2.20833333, 7],
              ]
          )
      )
  
imports: import random
  import networkx
  import numpy
  import pandas
  import pytest
  from _pytest.python_api import approx
  from dowhy import gcm
  from dowhy.gcm.util.general import apply_catboost_encoding, apply_one_hot_encoding, auto_apply_encoders, auto_fit_encoders, fit_catboost_encoders, fit_one_hot_encoders, has_categorical, is_categorical, is_discrete, set_random_seed, setdiff2d, shape_into_2d
label_desc: Use image node_id 11 for calling a global function with example usage: test_given_categorical_data_when_fit_catboost_encoders_and_apply_catboost_encoding_then_returns_expected_feature_vector() without return types