Skip to content

Commit

Permalink
Make test consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Sep 13, 2022
1 parent 805ec5d commit 7762cda
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pandas/tests/frame/test_nonunique_indexes.py
Expand Up @@ -318,23 +318,20 @@ def test_dup_columns_across_dtype(self):
xp.columns = ["A", "A", "B"]
tm.assert_frame_equal(rs, xp)

def test_set_value_by_index(self, using_array_manager):
def test_set_value_by_index(self):
# See gh-12344
warn = FutureWarning if using_array_manager else None
msg = "will attempt to set the values inplace"

df = DataFrame(np.arange(9).reshape(3, 3).T)
df.columns = list("AAA")
expected = df.iloc[:, 2]

with tm.assert_produces_warning(warn, match=msg):
with tm.assert_produces_warning(None):
df.iloc[:, 0] = 3
tm.assert_series_equal(df.iloc[:, 2], expected)

df = DataFrame(np.arange(9).reshape(3, 3).T)
df.columns = [2, float(2), str(2)]
expected = df.iloc[:, 1]

with tm.assert_produces_warning(warn, match=msg):
with tm.assert_produces_warning(None):
df.iloc[:, 0] = 3
tm.assert_series_equal(df.iloc[:, 1], expected)

0 comments on commit 7762cda

Please sign in to comment.