From 4c520e35f95429ceaf91ea67cd2ced5aabba9619 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Mon, 27 Nov 2023 23:45:46 +0100 Subject: [PATCH] CoW: Remove todos that aren't necessary (#56169) --- pandas/tests/apply/test_invalid_arg.py | 5 +++-- pandas/tests/copy_view/test_constructors.py | 1 - pandas/tests/copy_view/test_indexing.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pandas/tests/apply/test_invalid_arg.py b/pandas/tests/apply/test_invalid_arg.py index 9f8611dd4b08b..ae5b3eef4e4fe 100644 --- a/pandas/tests/apply/test_invalid_arg.py +++ b/pandas/tests/apply/test_invalid_arg.py @@ -152,7 +152,7 @@ def test_transform_axis_1_raises(): # TODO(CoW-warn) should not need to warn @pytest.mark.filterwarnings("ignore:Setting a value on a view:FutureWarning") -def test_apply_modify_traceback(): +def test_apply_modify_traceback(warn_copy_on_write): data = DataFrame( { "A": [ @@ -214,7 +214,8 @@ def transform2(row): msg = "'float' object has no attribute 'startswith'" with pytest.raises(AttributeError, match=msg): - data.apply(transform, axis=1) + with tm.assert_cow_warning(warn_copy_on_write): + data.apply(transform, axis=1) @pytest.mark.parametrize( diff --git a/pandas/tests/copy_view/test_constructors.py b/pandas/tests/copy_view/test_constructors.py index 89384a4ef6ba6..7d5c485958039 100644 --- a/pandas/tests/copy_view/test_constructors.py +++ b/pandas/tests/copy_view/test_constructors.py @@ -297,7 +297,6 @@ def test_dataframe_from_series_or_index( if using_copy_on_write: assert not df._mgr._has_no_reference(0) - # TODO(CoW-warn) should not warn for an index? with tm.assert_cow_warning(warn_copy_on_write): df.iloc[0, 0] = data[-1] if using_copy_on_write: diff --git a/pandas/tests/copy_view/test_indexing.py b/pandas/tests/copy_view/test_indexing.py index 2e623f885b648..72b7aea3709c0 100644 --- a/pandas/tests/copy_view/test_indexing.py +++ b/pandas/tests/copy_view/test_indexing.py @@ -913,7 +913,6 @@ def test_del_frame(backend, using_copy_on_write, warn_copy_on_write): tm.assert_frame_equal(df2, df_orig[["a", "c"]]) df2._mgr._verify_integrity() - # TODO(CoW-warn) false positive, this should not warn? with tm.assert_cow_warning(warn_copy_on_write and dtype_backend == "numpy"): df.loc[0, "b"] = 200 assert np.shares_memory(get_array(df, "a"), get_array(df2, "a"))