Skip to content

Commit 712d19f

Browse files
fixup tests for 2.3
1 parent e5f6d1d commit 712d19f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pandas/tests/copy_view/test_interp_fillna.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_interpolate_object_convert_no_op(using_copy_on_write, using_infer_strin
165165
df.interpolate(method="pad", inplace=True)
166166

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

pandas/tests/copy_view/test_replace.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,14 @@ def test_replace_empty_list(using_copy_on_write):
357357

358358

359359
@pytest.mark.parametrize("value", ["d", None])
360-
def test_replace_object_list_inplace(using_copy_on_write, value):
360+
def test_replace_object_list_inplace(using_copy_on_write, using_infer_string, value):
361361
df = DataFrame({"a": ["a", "b", "c"]}, dtype=object)
362362
arr = get_array(df, "a")
363-
df.replace(["c"], value, inplace=True)
364-
if using_copy_on_write or value is None:
363+
# with future.infer_string we get warning about object dtype getting cast
364+
warning = FutureWarning if using_infer_string and value is not None else None
365+
with tm.assert_produces_warning(warning):
366+
df.replace(["c"], value, inplace=True)
367+
if (using_copy_on_write or value is None) and not warning:
365368
assert np.shares_memory(arr, get_array(df, "a"))
366369
else:
367370
# This could be inplace

0 commit comments

Comments
 (0)