Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jun 13, 2024
1 parent 4bf94a0 commit 3d5116c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 6 additions & 8 deletions pandas/tests/copy_view/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,16 +805,14 @@ def test_set_value_copy_only_necessary_column(indexer_func, indexer, val, col):
view = df[:]

if val == "a":
with tm.assert_produces_warning(
FutureWarning, match="Setting an item of incompatible dtype is deprecated"
):
with pytest.raises(TypeError, match="Invalid value"):
indexer_func(df)[indexer] = val
else:
indexer_func(df)[indexer] = val

indexer_func(df)[indexer] = val

assert np.shares_memory(get_array(df, "b"), get_array(view, "b"))
assert not np.shares_memory(get_array(df, "a"), get_array(view, "a"))
tm.assert_frame_equal(view, df_orig)
assert np.shares_memory(get_array(df, "b"), get_array(view, "b"))
assert not np.shares_memory(get_array(df, "a"), get_array(view, "a"))
tm.assert_frame_equal(view, df_orig)


def test_series_midx_slice():
Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/series/methods/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def test_update(self):
def test_update_dtypes(self, other, dtype, expected, warn):
ser = Series([10, 11, 12], dtype=dtype)
other = Series(other, index=[1, 3])
with pytest.raises(TypeError, match="Invalid value"):
if warn:
with pytest.raises(TypeError, match="Invalid value"):
ser.update(other)
else:
ser.update(other)

@pytest.mark.parametrize(
Expand Down

0 comments on commit 3d5116c

Please sign in to comment.