code: def test_variables_cast_as_category(df_na):
      df_na = df_na.copy()
      df_na["City"] = df_na["City"].astype("category")
  
      # set up transformer
      imputer = RandomSampleImputer(
          variables=None, random_state=5, seed="general"
      )
      X_transformed = imputer.fit_transform(df_na)
  
      # expected output:
      # fillna based on seed used (found experimenting on Jupyter notebook)
      ref = {
          "Name": [
              "tom",
              "nick",
              "krish",
              "peter",
              "peter",
              "sam",
              "fred",
              "sam",
          ],
          "City": [
              "London",
              "Manchester",
              "London",
              "Manchester",
              "London",
              "London",
              "Bristol",
              "Manchester",
          ],
          "Studies": [
              "Bachelor",
              "Bachelor",
              "PhD",
              "Masters",
              "Bachelor",
              "PhD",
              "None",
              "Masters",
          ],
          "Age": [20, 21, 19, 23, 23, 40, 41, 37],
          "Marks": [0.9, 0.8, 0.7, 0.3, 0.3, 0.6, 0.8, 0.6],
          "dob": pd.date_range("2020-02-24", periods=8, freq="T"),
      }
      ref = pd.DataFrame(ref)
      ref["City"] = ref["City"].astype("category")
  
      # test fit attr
      assert imputer.variables_ == [
          "Name",
          "City",
          "Studies",
          "Age",
          "Marks",
          "dob",
      ]
      assert imputer.n_features_in_ == 6
      pd.testing.assert_frame_equal(imputer.X_, df_na)
  
      # test transform output
      pd.testing.assert_frame_equal(
          X_transformed, ref, check_dtype=False
      )
  
file_path: feature_engine/tests/test_imputation/test_random_sample_imputer.py
imports: import numpy
  import pandas
  import pytest
  from feature_engine.imputation import RandomSampleImputer
  from feature_engine.imputation.random_sample import _define_seed
label_desc: Use image node_id 11 for calling a global function with example usage: test_variables_cast_as_category(df_na) without return types