Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST: un-xfail string tests specific to object
  • Loading branch information
jbrockmendel committed Aug 7, 2024
commit beee34626b86aaeb0fdee94ab1116595a0931234
6 changes: 2 additions & 4 deletions pandas/tests/copy_view/test_interp_fillna.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

from pandas._config import using_string_dtype

from pandas import (
NA,
DataFrame,
Expand Down Expand Up @@ -112,18 +110,18 @@ def test_interp_fill_functions_inplace(func, dtype):
assert view._mgr._has_no_reference(0)


@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
def test_interpolate_cannot_with_object_dtype():
df = DataFrame({"a": ["a", np.nan, "c"], "b": 1})
df["a"] = df["a"].astype(object)

msg = "DataFrame cannot interpolate with object dtype"
with pytest.raises(TypeError, match=msg):
df.interpolate()


@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
def test_interpolate_object_convert_no_op():
df = DataFrame({"a": ["a", "b", "c"], "b": 1})
df["a"] = df["a"].astype(object)
arr_a = get_array(df, "a")

# Now CoW makes a copy, it should not!
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/copy_view/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,9 @@ def test_replace_empty_list():
assert not df2._mgr._has_no_reference(0)


@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
@pytest.mark.parametrize("value", ["d", None])
def test_replace_object_list_inplace(value):
df = DataFrame({"a": ["a", "b", "c"]})
df = DataFrame({"a": ["a", "b", "c"]}, dtype=object)
arr = get_array(df, "a")
df.replace(["c"], value, inplace=True)
assert np.shares_memory(arr, get_array(df, "a"))
Expand Down