From 3d5116c40e31b2bc8564d5abdf28e55c059b16c5 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:57:09 +0100 Subject: [PATCH] wip --- pandas/tests/copy_view/test_indexing.py | 14 ++++++-------- pandas/tests/series/methods/test_update.py | 5 ++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pandas/tests/copy_view/test_indexing.py b/pandas/tests/copy_view/test_indexing.py index 9b506fc197dab5..7f2769debf2103 100644 --- a/pandas/tests/copy_view/test_indexing.py +++ b/pandas/tests/copy_view/test_indexing.py @@ -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(): diff --git a/pandas/tests/series/methods/test_update.py b/pandas/tests/series/methods/test_update.py index 9122f9937e0da5..12164f6bbb6301 100644 --- a/pandas/tests/series/methods/test_update.py +++ b/pandas/tests/series/methods/test_update.py @@ -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(