code: def test_union_misc(self, sort):
      index = period_range("1/1/2000", "1/20/2000", freq="D")
  
      result = index[:-5].union(index[10:], sort=sort)
      tm.assert_index_equal(result, index)
  
      # not in order
      result = _permute(index[:-5]).union(
          _permute(index[10:]), sort=sort
      )
      if sort is False:
          tm.assert_index_equal(result.sort_values(), index)
      else:
          tm.assert_index_equal(result, index)
  
      # cast if different frequencies
      index = period_range("1/1/2000", "1/20/2000", freq="D")
      index2 = period_range("1/1/2000", "1/20/2000", freq="W-WED")
      result = index.union(index2, sort=sort)
      expected = index.astype(object).union(
          index2.astype(object), sort=sort
      )
      tm.assert_index_equal(result, expected)
  
file_path: pandas/pandas/tests/indexes/period/test_setops.py
imports: import numpy
  import pytest
  import pandas
  from pandas import PeriodIndex, date_range, period_range
  import pandas._testing
label_desc: Use image node_id 2 for calling the TestPeriodIndex obj's underlying member method code with example usage: obj.test_union_misc(sort) without return types