code: def test_set_column_with_index(using_copy_on_write):
      # Case: setting an index as a new column (df[col] = idx) copies that data
      df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
      idx = Index([1, 2, 3])
  
      df["c"] = idx
  
      # the index data is copied
      assert not np.shares_memory(get_array(df, "c"), idx.values)
  
      idx = RangeIndex(1, 4)
      arr = idx.values
  
      df["d"] = idx
  
      assert not np.shares_memory(get_array(df, "d"), arr)
  
file_path: pandas/pandas/tests/copy_view/test_setitem.py
imports: import numpy
  from pandas import DataFrame, Index, MultiIndex, RangeIndex, Series
  import pandas._testing
  from pandas.tests.copy_view.util import get_array
label_desc: Use image node_id 3 for calling a global function with example usage: test_set_column_with_index(using_copy_on_write) without return types