code: def test_union_duplicate_index_subsets_of_each_other(
      any_dtype_for_small_pos_integer_indexes,
  ):
      # GH#31326
      dtype = any_dtype_for_small_pos_integer_indexes
      a = Index([1, 2, 2, 3], dtype=dtype)
      b = Index([3, 3, 4], dtype=dtype)
  
      expected = Index([1, 2, 2, 3, 3, 4], dtype=dtype)
      if isinstance(a, CategoricalIndex):
          expected = Index([1, 2, 2, 3, 3, 4])
      result = a.union(b)
      tm.assert_index_equal(result, expected)
      result = a.union(b, sort=False)
      tm.assert_index_equal(result, expected)
  
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 11 for calling a global function with example usage: test_union_duplicate_index_subsets_of_each_other(any_dtype_for_small_pos_integer_indexes) without return types