Skip to content

Commit

Permalink
simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Dec 18, 2024
1 parent 3efcd72 commit 3cf8d5f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pandas/tests/copy_view/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,11 @@ def test_replace_empty_list(using_copy_on_write):


@pytest.mark.parametrize("value", ["d", None])
def test_replace_object_list_inplace(using_copy_on_write, using_infer_string, value):
def test_replace_object_list_inplace(using_copy_on_write, value):
df = DataFrame({"a": ["a", "b", "c"]}, dtype=object)
arr = get_array(df, "a")
# with future.infer_string we get warning about object dtype getting cast
warning = FutureWarning if using_infer_string and value is not None else None
with tm.assert_produces_warning(warning):
df.replace(["c"], value, inplace=True)
if (using_copy_on_write or value is None) and not warning:
df.replace(["c"], value, inplace=True)
if using_copy_on_write or value is None:
assert np.shares_memory(arr, get_array(df, "a"))
else:
# This could be inplace
Expand Down

0 comments on commit 3cf8d5f

Please sign in to comment.