code: def test_categorical_index(self):
      pidx = pd.CategoricalIndex([1, 2, 3])
      psidx = ps.CategoricalIndex([1, 2, 3])
  
      self.assert_eq(psidx, pidx)
      self.assert_eq(psidx.categories, pidx.categories)
      self.assert_eq(psidx.codes, pd.Index(pidx.codes))
      self.assert_eq(psidx.ordered, pidx.ordered)
  
      pidx = pd.Index([1, 2, 3], dtype="category")
      psidx = ps.Index([1, 2, 3], dtype="category")
  
      self.assert_eq(psidx, pidx)
      self.assert_eq(psidx.categories, pidx.categories)
      self.assert_eq(psidx.codes, pd.Index(pidx.codes))
      self.assert_eq(psidx.ordered, pidx.ordered)
  
      pdf = pd.DataFrame(
          {
              "a": pd.Categorical([1, 2, 3, 1, 2, 3]),
              "b": pd.Categorical(
                  ["a", "b", "c", "a", "b", "c"],
                  categories=["c", "b", "a"],
              ),
          },
          index=pd.Categorical(
              [10, 20, 30, 20, 30, 10],
              categories=[30, 10, 20],
              ordered=True,
          ),
      )
      psdf = ps.from_pandas(pdf)
  
      pidx = pdf.set_index("b").index
      psidx = psdf.set_index("b").index
  
      self.assert_eq(psidx, pidx)
      self.assert_eq(psidx.categories, pidx.categories)
      self.assert_eq(psidx.codes, pd.Index(pidx.codes))
      self.assert_eq(psidx.ordered, pidx.ordered)
  
      pidx = pdf.set_index(["a", "b"]).index.get_level_values(0)
      psidx = psdf.set_index(["a", "b"]).index.get_level_values(0)
  
      self.assert_eq(psidx, pidx)
      self.assert_eq(psidx.categories, pidx.categories)
      self.assert_eq(psidx.codes, pd.Index(pidx.codes))
      self.assert_eq(psidx.ordered, pidx.ordered)
  
      with self.assertRaisesRegex(
          TypeError, "Index.name must be a hashable type"
      ):
          ps.CategoricalIndex([1, 2, 3], name=[(1, 2, 3)])
      with self.assertRaisesRegex(
          TypeError,
          "Cannot perform 'all' with this index type: CategoricalIndex",
      ):
          ps.CategoricalIndex([1, 2, 3]).all()
  
imports: import unittest
  import pandas
  from pandas.api.types import CategoricalDtype
  import pyspark.pandas
  from pyspark.loose_version import LooseVersion
  from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils
label_desc: Use image node_id 1 for calling the CategoricalIndexTestsMixin obj's underlying member method code with example usage: obj.test_categorical_index() without return types