code: def test_index_equal_names(name1, name2):
      idx1 = Index([1, 2, 3], name=name1)
      idx2 = Index([1, 2, 3], name=name2)
  
      if name1 == name2 or name1 is name2:
          tm.assert_index_equal(idx1, idx2)
      else:
          name1 = "'x'" if name1 == "x" else name1
          name2 = "'x'" if name2 == "x" else name2
          msg = f"""Index are different
  
  Attribute "names" are different
  \\[left\\]:  \\[{name1}\\]
  \\[right\\]: \\[{name2}\\]"""
  
          with pytest.raises(AssertionError, match=msg):
              tm.assert_index_equal(idx1, idx2)
  
imports: import numpy
  import pytest
  from pandas import NA, Categorical, CategoricalIndex, Index, MultiIndex, NaT, RangeIndex
  import pandas._testing
label_desc: Use image node_id 12 for calling a global function with example usage: test_index_equal_names(name1, name2) without return types