code: def test_set_levels_categorical_keep_dtype():
      # GH#52125
      midx = MultiIndex.from_arrays([[5, 6]])
      result = midx.set_levels(levels=pd.Categorical([1, 2]), level=0)
      expected = MultiIndex.from_arrays([pd.Categorical([1, 2])])
      tm.assert_index_equal(result, expected)
  
imports: import numpy
  import pytest
  from pandas.compat import PY311
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  import pandas
  from pandas import CategoricalIndex, MultiIndex
  import pandas._testing
label_desc: Use image node_id 18 for calling a global function with example usage: test_set_levels_categorical_keep_dtype() without return types