code: def test_union_same_types(index):
      # Union with a non-unique, non-monotonic index raises error
      # Only needed for bool index factory
      idx1 = index.sort_values()
      idx2 = index.sort_values()
      assert idx1.union(idx2).dtype == idx1.dtype
  
imports: from datetime import datetime
  import operator
  import numpy
  import pytest
  from pandas._libs import lib
  from pandas.core.dtypes.cast import find_common_type
  from pandas import CategoricalDtype, CategoricalIndex, DatetimeTZDtype, Index, MultiIndex, PeriodDtype, RangeIndex, Series, Timestamp
  import pandas._testing
  from pandas.api.types import is_signed_integer_dtype, pandas_dtype
label_desc: Use image node_id 4 for calling a global function with example usage: test_union_same_types(index) without return types