|
21 | 21 | import numpy as np |
22 | 22 | import pytest |
23 | 23 |
|
24 | | -from pandas._config import using_string_dtype |
| 24 | +from pandas.compat import HAS_PYARROW |
25 | 25 |
|
26 | 26 | import pandas as pd |
27 | 27 | import pandas._testing as tm |
|
30 | 30 | from pandas.core.arrays.string_ import StringDtype |
31 | 31 | from pandas.tests.extension import base |
32 | 32 |
|
33 | | -pytestmark = pytest.mark.xfail( |
34 | | - using_string_dtype(), reason="TODO(infer_string)", strict=False |
35 | | -) |
36 | | - |
37 | 33 |
|
38 | 34 | def maybe_split_array(arr, chunked): |
39 | 35 | if not chunked: |
@@ -220,6 +216,36 @@ def test_compare_scalar(self, data, comparison_op): |
220 | 216 | def test_groupby_extension_apply(self, data_for_grouping, groupby_apply_op): |
221 | 217 | super().test_groupby_extension_apply(data_for_grouping, groupby_apply_op) |
222 | 218 |
|
| 219 | + def test_combine_add(self, data_repeated, using_infer_string, request): |
| 220 | + dtype = next(data_repeated(1)).dtype |
| 221 | + if using_infer_string and ( |
| 222 | + (dtype.na_value is pd.NA) and dtype.storage == "python" |
| 223 | + ): |
| 224 | + mark = pytest.mark.xfail( |
| 225 | + reason="The pointwise operation result will be inferred to " |
| 226 | + "string[nan, pyarrow], which does not match the input dtype" |
| 227 | + ) |
| 228 | + request.applymarker(mark) |
| 229 | + super().test_combine_add(data_repeated) |
| 230 | + |
| 231 | + def test_arith_series_with_array( |
| 232 | + self, data, all_arithmetic_operators, using_infer_string, request |
| 233 | + ): |
| 234 | + dtype = data.dtype |
| 235 | + if ( |
| 236 | + using_infer_string |
| 237 | + and all_arithmetic_operators == "__radd__" |
| 238 | + and ( |
| 239 | + (dtype.na_value is pd.NA) or (dtype.storage == "python" and HAS_PYARROW) |
| 240 | + ) |
| 241 | + ): |
| 242 | + mark = pytest.mark.xfail( |
| 243 | + reason="The pointwise operation result will be inferred to " |
| 244 | + "string[nan, pyarrow], which does not match the input dtype" |
| 245 | + ) |
| 246 | + request.applymarker(mark) |
| 247 | + super().test_arith_series_with_array(data, all_arithmetic_operators) |
| 248 | + |
223 | 249 |
|
224 | 250 | class Test2DCompat(base.Dim2CompatTests): |
225 | 251 | @pytest.fixture(autouse=True) |
|
0 commit comments