code: def test_union(self, tz, sort):
      rng1 = date_range("1/1/2000", freq="D", periods=5, tz=tz)
      other1 = date_range("1/6/2000", freq="D", periods=5, tz=tz)
      expected1 = date_range("1/1/2000", freq="D", periods=10, tz=tz)
      expected1_notsorted = DatetimeIndex(list(other1) + list(rng1))
  
      rng2 = date_range("1/1/2000", freq="D", periods=5, tz=tz)
      other2 = date_range("1/4/2000", freq="D", periods=5, tz=tz)
      expected2 = date_range("1/1/2000", freq="D", periods=8, tz=tz)
      expected2_notsorted = DatetimeIndex(list(other2) + list(rng2[:3]))
  
      rng3 = date_range("1/1/2000", freq="D", periods=5, tz=tz)
      other3 = DatetimeIndex([], tz=tz).as_unit("ns")
      expected3 = date_range("1/1/2000", freq="D", periods=5, tz=tz)
      expected3_notsorted = rng3
  
      for rng, other, exp, exp_notsorted in [
          (rng1, other1, expected1, expected1_notsorted),
          (rng2, other2, expected2, expected2_notsorted),
          (rng3, other3, expected3, expected3_notsorted),
      ]:
          result_union = rng.union(other, sort=sort)
          tm.assert_index_equal(result_union, exp)
  
          result_union = other.union(rng, sort=sort)
          if sort is None:
              tm.assert_index_equal(result_union, exp)
          else:
              tm.assert_index_equal(result_union, exp_notsorted)
  
imports: from datetime import datetime, timezone
  import numpy
  import pytest
  import pytz
  import pandas.util._test_decorators
  import pandas
  from pandas import DataFrame, DatetimeIndex, Index, Series, Timestamp, bdate_range, date_range
  import pandas._testing
  from pandas.tseries.offsets import BMonthEnd, Minute, MonthEnd
label_desc: Use image node_id 3 for calling the TestDatetimeIndexSetOps obj's underlying member method code with example usage: obj.test_union(tz, sort) without return types