Skip to content

Commit

Permalink
fixup tests for 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Nov 4, 2024
1 parent e5f6d1d commit 712d19f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pandas/tests/copy_view/test_interp_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_interpolate_object_convert_no_op(using_copy_on_write, using_infer_strin
df.interpolate(method="pad", inplace=True)

# Now CoW makes a copy, it should not!
if using_copy_on_write:
if using_copy_on_write and not using_infer_string:
assert df._mgr._has_no_reference(0)
assert np.shares_memory(arr_a, get_array(df, "a"))

Expand Down
9 changes: 6 additions & 3 deletions pandas/tests/copy_view/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,14 @@ 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, value):
def test_replace_object_list_inplace(using_copy_on_write, using_infer_string, value):
df = DataFrame({"a": ["a", "b", "c"]}, dtype=object)
arr = get_array(df, "a")
df.replace(["c"], value, inplace=True)
if using_copy_on_write or value is None:
# 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:
assert np.shares_memory(arr, get_array(df, "a"))
else:
# This could be inplace
Expand Down

0 comments on commit 712d19f

Please sign in to comment.