Skip to content

Commit c581a1f

Browse files
committed
TST (string): more targeted xfails in test_string.py
1 parent 57a4fb9 commit c581a1f

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

pandas/tests/extension/test_string.py

+31-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import numpy as np
2323
import pytest
2424

25-
from pandas._config import using_string_dtype
25+
from pandas.compat import HAS_PYARROW
2626

2727
import pandas as pd
2828
import pandas._testing as tm
@@ -31,10 +31,6 @@
3131
from pandas.core.arrays.string_ import StringDtype
3232
from pandas.tests.extension import base
3333

34-
pytestmark = pytest.mark.xfail(
35-
using_string_dtype(), reason="TODO(infer_string)", strict=False
36-
)
37-
3834

3935
def maybe_split_array(arr, chunked):
4036
if not chunked:
@@ -217,6 +213,36 @@ def test_compare_scalar(self, data, comparison_op):
217213
def test_groupby_extension_apply(self, data_for_grouping, groupby_apply_op):
218214
super().test_groupby_extension_apply(data_for_grouping, groupby_apply_op)
219215

216+
def test_combine_add(self, data_repeated, using_infer_string, request):
217+
dtype = next(data_repeated(1)).dtype
218+
if using_infer_string and (
219+
(dtype.na_value is pd.NA) and (dtype.storage == "python" and HAS_PYARROW)
220+
):
221+
mark = pytest.mark.xfail(
222+
reason="The pointwise operation result will be inferred to "
223+
"string[nan, pyarrow], which does not match the input dtype"
224+
)
225+
request.node.add_marker(mark)
226+
super().test_combine_add(data_repeated)
227+
228+
def test_arith_series_with_array(
229+
self, data, all_arithmetic_operators, using_infer_string, request
230+
):
231+
dtype = data.dtype
232+
if (
233+
using_infer_string
234+
and all_arithmetic_operators == "__radd__"
235+
and (
236+
(dtype.na_value is pd.NA) or (dtype.storage == "python" and HAS_PYARROW)
237+
)
238+
):
239+
mark = pytest.mark.xfail(
240+
reason="The pointwise operation result will be inferred to "
241+
"string[nan, pyarrow], which does not match the input dtype"
242+
)
243+
request.node.add_marker(mark)
244+
super().test_arith_series_with_array(data, all_arithmetic_operators)
245+
220246

221247
class Test2DCompat(base.Dim2CompatTests):
222248
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)