@@ -27,7 +27,7 @@ def test_set_index_update_column(using_copy_on_write):
2727 if using_copy_on_write :
2828 tm .assert_index_equal (df .index , expected )
2929 else :
30- tm .assert_index_equal (df .index , Index ([100 , 1 ] ))
30+ tm .assert_index_equal (df .index , Index ([100 , 2 ], name = "a" ))
3131
3232
3333def test_set_index_drop_update_column (using_copy_on_write ):
@@ -36,10 +36,7 @@ def test_set_index_drop_update_column(using_copy_on_write):
3636 df = df .set_index ("a" , drop = True )
3737 expected = df .index .copy (deep = True )
3838 view .iloc [0 , 0 ] = 100
39- if using_copy_on_write :
40- tm .assert_index_equal (df .index , expected )
41- else :
42- tm .assert_index_equal (df .index , Index ([100 , 1 ]))
39+ tm .assert_index_equal (df .index , expected )
4340
4441
4542def test_set_index_series (using_copy_on_write ):
@@ -51,7 +48,7 @@ def test_set_index_series(using_copy_on_write):
5148 if using_copy_on_write :
5249 tm .assert_index_equal (df .index , expected )
5350 else :
54- tm .assert_index_equal (df .index , Index ([100 , 1 ]))
51+ tm .assert_index_equal (df .index , Index ([100 , 11 ]))
5552
5653
5754def test_assign_index_as_series (using_copy_on_write ):
@@ -63,7 +60,7 @@ def test_assign_index_as_series(using_copy_on_write):
6360 if using_copy_on_write :
6461 tm .assert_index_equal (df .index , expected )
6562 else :
66- tm .assert_index_equal (df .index , Index ([100 , 1 ]))
63+ tm .assert_index_equal (df .index , Index ([100 , 11 ]))
6764
6865
6966def test_assign_index_as_index (using_copy_on_write ):
@@ -77,16 +74,18 @@ def test_assign_index_as_index(using_copy_on_write):
7774 if using_copy_on_write :
7875 tm .assert_index_equal (df .index , expected )
7976 else :
80- tm .assert_index_equal (df .index , Index ([100 , 1 ]))
77+ tm .assert_index_equal (df .index , Index ([100 , 11 ]))
8178
8279
8380def test_index_from_series (using_copy_on_write ):
8481 ser = Series ([1 , 2 ])
8582 idx = Index (ser )
8683 expected = idx .copy (deep = True )
8784 ser .iloc [0 ] = 100
88- print (idx )
89- tm .assert_index_equal (idx , expected )
85+ if using_copy_on_write :
86+ tm .assert_index_equal (idx , expected )
87+ else :
88+ tm .assert_index_equal (idx , Index ([100 , 2 ]))
9089
9190
9291def test_index_from_series_copy (using_copy_on_write ):
@@ -103,7 +102,10 @@ def test_index_from_index(using_copy_on_write):
103102 idx = Index (idx )
104103 expected = idx .copy (deep = True )
105104 ser .iloc [0 ] = 100
106- tm .assert_index_equal (idx , expected )
105+ if using_copy_on_write :
106+ tm .assert_index_equal (idx , expected )
107+ else :
108+ tm .assert_index_equal (idx , Index ([100 , 2 ]))
107109
108110
109111@pytest .mark .parametrize (
0 commit comments