code: def test_unique(index_or_series_obj):
      obj = index_or_series_obj
      obj = np.repeat(obj, range(1, len(obj) + 1))
      result = obj.unique()
  
      # dict.fromkeys preserves the order
      unique_values = list(dict.fromkeys(obj.values))
      if isinstance(obj, pd.MultiIndex):
          expected = pd.MultiIndex.from_tuples(unique_values)
          expected.names = obj.names
          tm.assert_index_equal(result, expected, exact=True)
      elif isinstance(obj, pd.Index):
          expected = pd.Index(unique_values, dtype=obj.dtype)
          if isinstance(obj.dtype, pd.DatetimeTZDtype):
              expected = expected.normalize()
          tm.assert_index_equal(result, expected, exact=True)
      else:
          expected = np.array(unique_values)
          tm.assert_numpy_array_equal(result, expected)
  
file_path: pandas/pandas/tests/base/test_unique.py
imports: import numpy
  import pytest
  from pandas._config import using_pyarrow_string_dtype
  import pandas
  import pandas._testing
  from pandas.tests.base.common import allow_na_ops
label_desc: Use image node_id 1 for calling a global function with example usage: test_unique(index_or_series_obj) without return types