code: def test_unique_index_series(self, ordered):
      # GH38140
      dtype = CategoricalDtype([3, 2, 1], ordered=ordered)
  
      c = Categorical([3, 1, 2, 2, 1], dtype=dtype)
      # Categorical.unique sorts categories by appearance order
      # if ordered=False
      exp = Categorical([3, 1, 2], dtype=dtype)
      tm.assert_categorical_equal(c.unique(), exp)
  
      tm.assert_index_equal(Index(c).unique(), Index(exp))
      tm.assert_categorical_equal(Series(c).unique(), exp)
  
      c = Categorical([1, 1, 2, 2], dtype=dtype)
      exp = Categorical([1, 2], dtype=dtype)
      tm.assert_categorical_equal(c.unique(), exp)
      tm.assert_index_equal(Index(c).unique(), Index(exp))
      tm.assert_categorical_equal(Series(c).unique(), exp)
  
imports: import re
  import sys
  import numpy
  import pytest
  from pandas.compat import PYPY
  from pandas import Categorical, CategoricalDtype, DataFrame, Index, NaT, Series, date_range
  import pandas._testing
  from pandas.api.types import is_scalar
label_desc: Use image node_id 14 for calling the TestCategoricalAnalytics obj's underlying member method code with example usage: obj.test_unique_index_series(ordered) without return types