Skip to content

Commit

Permalink
wip enforce pdep6
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jun 13, 2024
1 parent 3d5116c commit 6bdc2ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pandas/tests/copy_view/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,16 +725,15 @@ def test_column_as_series_set_with_upcast(backend):
with pytest.raises(TypeError, match="Invalid value"):
s[0] = "foo"
expected = Series([1, 2, 3], name="a")
tm.assert_series_equal(s, expected)
tm.assert_frame_equal(df, df_orig)
# ensure cached series on getitem is not the changed series
tm.assert_series_equal(df["a"], df_orig["a"])
else:
with pytest.raises(TypeError, match="Invalid value"):
s[0] = "foo"
return

tm.assert_series_equal(s, expected)
tm.assert_frame_equal(df, df_orig)
# ensure cached series on getitem is not the changed series
tm.assert_series_equal(df["a"], df_orig["a"])


@pytest.mark.parametrize(
"method",
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/indexing/multiindex/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ def test_multiindex_assignment_single_dtype(self):
# arr + 0.5 cannot be cast losslessly to int, so we upcast
with pytest.raises(TypeError, match="Invalid value"):
df.loc[4, "c"] = arr + 0.5
df = df.astype({"c": "float64"})
df.loc[4, "c"] = arr + 0.5

# scalar ok
df.loc[4, "c"] = 10
Expand Down

0 comments on commit 6bdc2ec

Please sign in to comment.