code: def test_ix_categorical_index_non_unique(self, infer_string):
      # non-unique
      with option_context("future.infer_string", infer_string):
          df = DataFrame(
              np.random.default_rng(2).standard_normal((3, 3)),
              index=list("ABA"),
              columns=list("XYX"),
          )
          cdf = df.copy()
          cdf.index = CategoricalIndex(df.index)
          cdf.columns = CategoricalIndex(df.columns)
  
          exp_index = CategoricalIndex(
              list("AA"), categories=["A", "B"]
          )
          expect = DataFrame(
              df.loc["A", :], columns=cdf.columns, index=exp_index
          )
          tm.assert_frame_equal(cdf.loc["A", :], expect)
  
          exp_columns = CategoricalIndex(
              list("XX"), categories=["X", "Y"]
          )
          expect = DataFrame(
              df.loc[:, "X"], index=cdf.index, columns=exp_columns
          )
          tm.assert_frame_equal(cdf.loc[:, "X"], expect)
  
          expect = DataFrame(
              df.loc[["A", "B"], :],
              columns=cdf.columns,
              index=CategoricalIndex(list("AAB")),
          )
          tm.assert_frame_equal(cdf.loc[["A", "B"], :], expect)
  
          expect = DataFrame(
              df.loc[:, ["X", "Y"]],
              index=cdf.index,
              columns=CategoricalIndex(list("XXY")),
          )
          tm.assert_frame_equal(cdf.loc[:, ["X", "Y"]], expect)
  
imports: import re
  import numpy
  import pytest
  import pandas.util._test_decorators
  import pandas
  from pandas import Categorical, CategoricalDtype, CategoricalIndex, DataFrame, Index, Interval, Series, Timedelta, Timestamp, option_context
  import pandas._testing
label_desc: Use image node_id 17 for calling the TestCategoricalIndex obj's underlying member method code with example usage: obj.test_ix_categorical_index_non_unique(infer_string) without return types