code: def test_intersection(self):
      pidx1 = pd.CategoricalIndex(
          ["x", "y", "z"], categories=["z", "y", "x", "w"]
      )
      pidx2 = pd.CategoricalIndex(
          ["y", "x", "w"], categories=["z", "y", "x", "w"]
      )
      pidx3 = pd.Index(["y", "x", "w", "z"])
      psidx1 = ps.from_pandas(pidx1)
      psidx2 = ps.from_pandas(pidx2)
      psidx3 = ps.from_pandas(pidx3)
  
      self.assert_eq(
          psidx1.intersection(psidx2).sort_values(),
          pidx1.intersection(pidx2).sort_values(),
      )
      self.assert_eq(
          psidx1.intersection(psidx3.astype("category")).sort_values(),
          pidx1.intersection(pidx3.astype("category")).sort_values(),
      )
  
      # TODO: intersection non-categorical or categorical with a different category
      self.assertRaises(
          NotImplementedError, lambda: psidx1.intersection(psidx3)
      )
  
      pidx4 = pd.CategoricalIndex(
          ["y", "x", "w"], categories=["z", "y", "x"]
      )
      psidx4 = ps.from_pandas(pidx4)
      self.assertRaises(
          NotImplementedError, lambda: psidx1.intersection(psidx4)
      )
  
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 12 for calling the CategoricalIndexTestsMixin obj's underlying member method code with example usage: obj.test_intersection() without return types