code: def test_set_index_names(self):
      df = DataFrame(
          np.ones((10, 4)),
          columns=Index(list("ABCD"), dtype=object),
          index=Index([f"i-{i}" for i in range(10)], dtype=object),
      )
      df.index.name = "name"
  
      assert df.set_index(df.index).index.names == ["name"]
  
      mi = MultiIndex.from_arrays(
          df[["A", "B"]].T.values, names=["A", "B"]
      )
      mi2 = MultiIndex.from_arrays(
          df[["A", "B", "A", "B"]].T.values, names=["A", "B", "C", "D"]
      )
  
      df = df.set_index(["A", "B"])
  
      assert df.set_index(df.index).index.names == ["A", "B"]
  
      # Check that set_index isn't converting a MultiIndex into an Index
      assert isinstance(df.set_index(df.index).index, MultiIndex)
  
      # Check actual equality
      tm.assert_index_equal(df.set_index(df.index).index, mi)
  
      idx2 = df.index.rename(["C", "D"])
  
      # Check that [MultiIndex, MultiIndex] yields a MultiIndex rather
      # than a pair of tuples
      assert isinstance(
          df.set_index([df.index, idx2]).index, MultiIndex
      )
  
      # Check equality
      tm.assert_index_equal(df.set_index([df.index, idx2]).index, mi2)
  
imports: from datetime import datetime, timedelta
  import numpy
  import pytest
  from pandas import Categorical, CategoricalIndex, DataFrame, DatetimeIndex, Index, MultiIndex, Series, date_range, period_range, to_datetime
  import pandas._testing
label_desc: Use image node_id 9 for calling the TestSetIndex obj's underlying member method code with example usage: obj.test_set_index_names() without return types