code: def test_union_with_regular_index(idx, using_infer_string):
      other = Index(["A", "B", "C"])
  
      result = other.union(idx)
      assert ("foo", "one") in result
      assert "B" in result
  
      if using_infer_string:
          with pytest.raises(
              NotImplementedError, match="Can only union"
          ):
              idx.union(other)
      else:
          msg = "The values in the array are unorderable"
          with tm.assert_produces_warning(RuntimeWarning, match=msg):
              result2 = idx.union(other)
          # This is more consistent now, if sorting fails then we don't sort at all
          # in the MultiIndex case.
          assert not result.equals(result2)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import CategoricalIndex, DataFrame, Index, IntervalIndex, MultiIndex, Series
  import pandas._testing
  from pandas.api.types import is_float_dtype, is_unsigned_integer_dtype
label_desc: Use image node_id 14 for calling a global function with example usage: test_union_with_regular_index(idx, using_infer_string) without return types