|
22 | 22 | import numpy as np
|
23 | 23 | import pytest
|
24 | 24 |
|
25 |
| -from pandas._config import using_string_dtype |
| 25 | +from pandas.compat import HAS_PYARROW |
26 | 26 |
|
27 | 27 | import pandas as pd
|
28 | 28 | import pandas._testing as tm
|
|
31 | 31 | from pandas.core.arrays.string_ import StringDtype
|
32 | 32 | from pandas.tests.extension import base
|
33 | 33 |
|
34 |
| -pytestmark = pytest.mark.xfail( |
35 |
| - using_string_dtype(), reason="TODO(infer_string)", strict=False |
36 |
| -) |
37 |
| - |
38 | 34 |
|
39 | 35 | def maybe_split_array(arr, chunked):
|
40 | 36 | if not chunked:
|
@@ -217,6 +213,36 @@ def test_compare_scalar(self, data, comparison_op):
|
217 | 213 | def test_groupby_extension_apply(self, data_for_grouping, groupby_apply_op):
|
218 | 214 | super().test_groupby_extension_apply(data_for_grouping, groupby_apply_op)
|
219 | 215 |
|
| 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" |
| 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.applymarker(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.applymarker(mark) |
| 244 | + super().test_arith_series_with_array(data, all_arithmetic_operators) |
| 245 | + |
220 | 246 |
|
221 | 247 | class Test2DCompat(base.Dim2CompatTests):
|
222 | 248 | @pytest.fixture(autouse=True)
|
|
0 commit comments