Skip to content

Commit 0b2bd61

Browse files
add some xfails
1 parent d414dc9 commit 0b2bd61

33 files changed

+176
-10
lines changed

pandas/tests/apply/test_invalid_arg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import numpy as np
1313
import pytest
1414

15+
from pandas._config import using_string_dtype
16+
1517
from pandas.errors import SpecificationError
1618

1719
from pandas import (
@@ -209,6 +211,8 @@ def transform(row):
209211
data.apply(transform, axis=1)
210212

211213

214+
# we should raise a proper TypeError instead of propagating the pyarrow error
215+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
212216
@pytest.mark.parametrize(
213217
"df, func, expected",
214218
tm.get_cython_table_params(
@@ -229,6 +233,8 @@ def test_agg_cython_table_raises_frame(df, func, expected, axis, using_infer_str
229233
df.agg(func, axis=axis)
230234

231235

236+
# we should raise a proper TypeError instead of propagating the pyarrow error
237+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
232238
@pytest.mark.parametrize(
233239
"series, func, expected",
234240
chain(

pandas/tests/apply/test_numba.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def test_numba_nonunique_unsupported(apply_axis):
104104

105105

106106
def test_numba_unsupported_dtypes(apply_axis):
107+
pytest.importorskip("pyarrow")
107108
f = lambda x: x
108109
df = DataFrame({"a": [1, 2], "b": ["a", "b"], "c": [4, 5]})
109110
df["c"] = df["c"].astype("double[pyarrow]")

pandas/tests/arrays/boolean/test_arithmetic.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import numpy as np
44
import pytest
55

6+
from pandas._config import using_string_dtype
7+
8+
from pandas.compat import HAS_PYARROW
9+
610
import pandas as pd
711
import pandas._testing as tm
812

@@ -90,6 +94,9 @@ def test_op_int8(left_array, right_array, opname):
9094
# -----------------------------------------------------------------------------
9195

9296

97+
@pytest.mark.xfail(
98+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)"
99+
)
93100
def test_error_invalid_values(data, all_arithmetic_operators, using_infer_string):
94101
# invalid ops
95102

pandas/tests/extension/base/ops.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class BaseArithmeticOpsTests(BaseOpsUtil):
140140
series_array_exc: type[Exception] | None = TypeError
141141
divmod_exc: type[Exception] | None = TypeError
142142

143+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
143144
def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
144145
# series & scalar
145146
if all_arithmetic_operators == "__rmod__" and is_string_dtype(data.dtype):
@@ -149,6 +150,7 @@ def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
149150
ser = pd.Series(data)
150151
self.check_opname(ser, op_name, ser.iloc[0])
151152

153+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
152154
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
153155
# frame & scalar
154156
if all_arithmetic_operators == "__rmod__" and is_string_dtype(data.dtype):
@@ -158,12 +160,14 @@ def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
158160
df = pd.DataFrame({"A": data})
159161
self.check_opname(df, op_name, data[0])
160162

163+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
161164
def test_arith_series_with_array(self, data, all_arithmetic_operators):
162165
# ndarray & other series
163166
op_name = all_arithmetic_operators
164167
ser = pd.Series(data)
165168
self.check_opname(ser, op_name, pd.Series([ser.iloc[0]] * len(ser)))
166169

170+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
167171
def test_divmod(self, data):
168172
ser = pd.Series(data)
169173
self._check_divmod_op(ser, divmod, 1)
@@ -179,6 +183,7 @@ def test_divmod_series_array(self, data, data_for_twos):
179183
other = pd.Series(other)
180184
self._check_divmod_op(other, ops.rdivmod, ser)
181185

186+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
182187
def test_add_series_with_extension_array(self, data):
183188
# Check adding an ExtensionArray to a Series of the same dtype matches
184189
# the behavior of adding the arrays directly and then wrapping in a

pandas/tests/extension/test_categorical.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def test_map(self, data, na_action):
140140
result = data.map(lambda x: x, na_action=na_action)
141141
tm.assert_extension_array_equal(result, data)
142142

143+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
143144
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
144145
# frame & scalar
145146
op_name = all_arithmetic_operators
@@ -151,6 +152,7 @@ def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
151152
)
152153
super().test_arith_frame_with_scalar(data, op_name)
153154

155+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
154156
def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request):
155157
op_name = all_arithmetic_operators
156158
if op_name == "__rmod__":

pandas/tests/extension/test_numpy.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import numpy as np
2020
import pytest
2121

22+
from pandas._config import using_string_dtype
23+
2224
from pandas.core.dtypes.dtypes import NumpyEADtype
2325

2426
import pandas as pd
@@ -255,13 +257,15 @@ def test_insert_invalid(self, data, invalid_scalar):
255257
frame_scalar_exc = None
256258
series_array_exc = None
257259

260+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
258261
def test_divmod(self, data):
259262
divmod_exc = None
260263
if data.dtype.kind == "O":
261264
divmod_exc = TypeError
262265
self.divmod_exc = divmod_exc
263266
super().test_divmod(data)
264267

268+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
265269
def test_divmod_series_array(self, data):
266270
ser = pd.Series(data)
267271
exc = None
@@ -270,6 +274,7 @@ def test_divmod_series_array(self, data):
270274
self.divmod_exc = exc
271275
self._check_divmod_op(ser, divmod, data)
272276

277+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
273278
def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request):
274279
opname = all_arithmetic_operators
275280
series_scalar_exc = None
@@ -283,6 +288,7 @@ def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request)
283288
self.series_scalar_exc = series_scalar_exc
284289
super().test_arith_series_with_scalar(data, all_arithmetic_operators)
285290

291+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
286292
def test_arith_series_with_array(self, data, all_arithmetic_operators):
287293
opname = all_arithmetic_operators
288294
series_array_exc = None
@@ -291,6 +297,7 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators):
291297
self.series_array_exc = series_array_exc
292298
super().test_arith_series_with_array(data, all_arithmetic_operators)
293299

300+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
294301
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
295302
opname = all_arithmetic_operators
296303
frame_scalar_exc = None

pandas/tests/frame/indexing/test_where.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from pandas._config import using_string_dtype
88

9+
from pandas.compat import HAS_PYARROW
10+
911
from pandas.core.dtypes.common import is_scalar
1012

1113
import pandas as pd
@@ -1018,6 +1020,9 @@ def test_where_producing_ea_cond_for_np_dtype():
10181020
tm.assert_frame_equal(result, expected)
10191021

10201022

1023+
@pytest.mark.xfail(
1024+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)", strict=False
1025+
)
10211026
@pytest.mark.parametrize(
10221027
"replacement", [0.001, True, "snake", None, datetime(2022, 5, 4)]
10231028
)

pandas/tests/frame/methods/test_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pandas._config import using_string_dtype
1111

1212
from pandas.compat import (
13+
HAS_PYARROW,
1314
IS64,
1415
PYPY,
1516
)
@@ -520,7 +521,7 @@ def test_info_int_columns():
520521
assert result == expected
521522

522523

523-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
524+
@pytest.mark.xfail(using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string)")
524525
def test_memory_usage_empty_no_warning():
525526
# GH#50066
526527
df = DataFrame(index=["a", "b"])

pandas/tests/frame/methods/test_rank.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
import numpy as np
77
import pytest
88

9+
from pandas._config import using_string_dtype
10+
911
from pandas._libs.algos import (
1012
Infinity,
1113
NegInfinity,
1214
)
15+
from pandas.compat import HAS_PYARROW
1316

1417
from pandas import (
1518
DataFrame,
@@ -464,9 +467,18 @@ def test_rank_inf_nans_na_option(
464467
],
465468
)
466469
def test_rank_object_first(
467-
self, frame_or_series, na_option, ascending, expected, using_infer_string
470+
self,
471+
request,
472+
frame_or_series,
473+
na_option,
474+
ascending,
475+
expected,
476+
using_infer_string,
468477
):
469478
obj = frame_or_series(["foo", "foo", None, "foo"])
479+
if using_string_dtype() and not HAS_PYARROW and isinstance(obj, Series):
480+
request.applymarker(pytest.mark.xfail(reason="TODO(infer_string)"))
481+
470482
result = obj.rank(method="first", na_option=na_option, ascending=ascending)
471483
expected = frame_or_series(expected)
472484
if using_infer_string and isinstance(obj, Series):

pandas/tests/frame/methods/test_value_counts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._config import using_string_dtype
5+
6+
from pandas.compat import HAS_PYARROW
7+
48
import pandas as pd
59
import pandas._testing as tm
610

@@ -132,6 +136,9 @@ def test_data_frame_value_counts_dropna_true(nulls_fixture):
132136
tm.assert_series_equal(result, expected)
133137

134138

139+
@pytest.mark.xfail(
140+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)"
141+
)
135142
def test_data_frame_value_counts_dropna_false(nulls_fixture):
136143
# GH 41334
137144
df = pd.DataFrame(

0 commit comments

Comments
 (0)