code: def test_pairwise_with_self(
      self, pairwise_frames, pairwise_target_frame, f
  ):
      # DataFrame with itself, pairwise=True
      # note that we may construct the 1st level of the MI
      # in a non-monotonic way, so compare accordingly
      result = f(pairwise_frames)
      tm.assert_index_equal(
          result.index.levels[0],
          pairwise_frames.index,
          check_names=False,
      )
      tm.assert_index_equal(
          safe_sort(result.index.levels[1]),
          safe_sort(pairwise_frames.columns.unique()),
      )
      tm.assert_index_equal(result.columns, pairwise_frames.columns)
      expected = f(pairwise_target_frame)
      # since we have sorted the results
      # we can only compare non-nans
      result = result.dropna().values
      expected = expected.dropna().values
  
      tm.assert_numpy_array_equal(result, expected, check_dtype=False)
  
imports: import numpy
  import pytest
  from pandas.compat import IS64
  from pandas import DataFrame, Index, MultiIndex, Series, date_range
  import pandas._testing
  from pandas.core.algorithms import safe_sort
label_desc: Use image node_id 2 for calling the TestPairwise obj's underlying member method code with example usage: obj.test_pairwise_with_self(pairwise_frames, pairwise_target_frame, f) without return types