Skip to content

Commit 9c7e10f

Browse files
more xfails
1 parent 6cb752c commit 9c7e10f

File tree

12 files changed

+42
-4
lines changed

12 files changed

+42
-4
lines changed

pandas/tests/extension/base/ops.py

+4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
150150
ser = pd.Series(data)
151151
self.check_opname(ser, op_name, ser.iloc[0])
152152

153+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
153154
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
154155
# frame & scalar
155156
if all_arithmetic_operators == "__rmod__" and is_string_dtype(data.dtype):
@@ -159,12 +160,14 @@ def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
159160
df = pd.DataFrame({"A": data})
160161
self.check_opname(df, op_name, data[0])
161162

163+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
162164
def test_arith_series_with_array(self, data, all_arithmetic_operators):
163165
# ndarray & other series
164166
op_name = all_arithmetic_operators
165167
ser = pd.Series(data)
166168
self.check_opname(ser, op_name, pd.Series([ser.iloc[0]] * len(ser)))
167169

170+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
168171
def test_divmod(self, data):
169172
ser = pd.Series(data)
170173
self._check_divmod_op(ser, divmod, 1)
@@ -180,6 +183,7 @@ def test_divmod_series_array(self, data, data_for_twos):
180183
other = pd.Series(other)
181184
self._check_divmod_op(other, ops.rdivmod, ser)
182185

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

pandas/tests/extension/test_categorical.py

+2
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

+7
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/test_reductions.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def float_frame_with_na():
226226
class TestDataFrameAnalytics:
227227
# ---------------------------------------------------------------------
228228
# Reductions
229+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
229230
@pytest.mark.parametrize("axis", [0, 1])
230231
@pytest.mark.parametrize(
231232
"opname",
@@ -431,6 +432,7 @@ def test_stat_operators_attempt_obj_array(self, method, df, axis):
431432
expected[expected.isna()] = None
432433
tm.assert_series_equal(result, expected)
433434

435+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
434436
@pytest.mark.parametrize("op", ["mean", "std", "var", "skew", "kurt", "sem"])
435437
def test_mixed_ops(self, op):
436438
# GH#16116
@@ -532,7 +534,7 @@ def test_mean_mixed_string_decimal(self):
532534
df = DataFrame(d)
533535

534536
with pytest.raises(
535-
TypeError, match="unsupported operand type|does not support"
537+
TypeError, match="unsupported operand type|does not support|Cannot perform"
536538
):
537539
df.mean()
538540
result = df[["A", "C"]].mean()
@@ -690,6 +692,7 @@ def test_mode_dropna(self, dropna, expected):
690692
expected = DataFrame(expected)
691693
tm.assert_frame_equal(result, expected)
692694

695+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
693696
def test_mode_sortwarning(self, using_infer_string):
694697
# Check for the warning that is raised when the mode
695698
# results cannot be sorted
@@ -979,7 +982,7 @@ def test_sum_mixed_datetime(self):
979982

980983
def test_mean_corner(self, float_frame, float_string_frame):
981984
# unit test when have object data
982-
msg = "Could not convert|does not support"
985+
msg = "Could not convert|does not support|Cannot perform"
983986
with pytest.raises(TypeError, match=msg):
984987
float_string_frame.mean(axis=0)
985988

@@ -1093,6 +1096,7 @@ def test_idxmin_empty(self, index, skipna, axis):
10931096
expected = Series(dtype=index.dtype)
10941097
tm.assert_series_equal(result, expected)
10951098

1099+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
10961100
@pytest.mark.parametrize("numeric_only", [True, False])
10971101
def test_idxmin_numeric_only(self, numeric_only):
10981102
df = DataFrame({"a": [2, 3, 1], "b": [2, 1, 1], "c": list("xyx")})
@@ -1143,6 +1147,7 @@ def test_idxmax_empty(self, index, skipna, axis):
11431147
expected = Series(dtype=index.dtype)
11441148
tm.assert_series_equal(result, expected)
11451149

1150+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
11461151
@pytest.mark.parametrize("numeric_only", [True, False])
11471152
def test_idxmax_numeric_only(self, numeric_only):
11481153
df = DataFrame({"a": [2, 3, 1], "b": [2, 1, 1], "c": list("xyx")})
@@ -1964,7 +1969,7 @@ def test_minmax_extensionarray(method, numeric_only):
19641969
def test_frame_mixed_numeric_object_with_timestamp(ts_value):
19651970
# GH 13912
19661971
df = DataFrame({"a": [1], "b": [1.1], "c": ["foo"], "d": [ts_value]})
1967-
with pytest.raises(TypeError, match="does not support operation"):
1972+
with pytest.raises(TypeError, match="does not support operation|Cannot perform"):
19681973
df.sum()
19691974

19701975

pandas/tests/frame/test_subclass.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._config import using_string_dtype
5+
46
import pandas as pd
57
from pandas import (
68
DataFrame,
@@ -147,6 +149,7 @@ def nonexistence(self):
147149
with pytest.raises(AttributeError, match=".*i_dont_exist.*"):
148150
A().nonexistence
149151

152+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
150153
def test_subclass_align(self):
151154
# GH 12983
152155
df1 = tm.SubclassedDataFrame(
@@ -176,6 +179,7 @@ def test_subclass_align(self):
176179
assert isinstance(res2, tm.SubclassedSeries)
177180
tm.assert_series_equal(res2, exp2.c)
178181

182+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
179183
def test_subclass_align_combinations(self):
180184
# GH 12983
181185
df = tm.SubclassedDataFrame({"a": [1, 3, 5], "b": [1, 3, 5]}, index=list("ACE"))

pandas/tests/frame/test_unary.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_neg_object(self, df, expected):
4242
tm.assert_frame_equal(-df, expected)
4343
tm.assert_series_equal(-df["a"], expected["a"])
4444

45+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
4546
@pytest.mark.parametrize(
4647
"df_data",
4748
[
@@ -130,7 +131,7 @@ def test_pos_object(self, df_data):
130131
tm.assert_frame_equal(+df, df)
131132
tm.assert_series_equal(+df["a"], df["a"])
132133

133-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
134+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
134135
@pytest.mark.filterwarnings("ignore:Applying:DeprecationWarning")
135136
def test_pos_object_raises(self):
136137
# GH#21380

pandas/tests/groupby/methods/test_value_counts.py

+1
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ def test_dropna_combinations(
500500
tm.assert_series_equal(result, expected)
501501

502502

503+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
503504
@pytest.mark.parametrize(
504505
"dropna, expected_data, expected_index",
505506
[

pandas/tests/groupby/test_groupby.py

+2
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,8 @@ def g(group):
14071407
tm.assert_series_equal(result, expected)
14081408

14091409

1410+
# TODO harmonize error messages
1411+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14101412
@pytest.mark.parametrize("grouper", ["A", ["A", "B"]])
14111413
def test_set_group_name(df, grouper, using_infer_string):
14121414
def f(group):

pandas/tests/indexes/multi/test_join.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._config import using_string_dtype
5+
46
from pandas import (
57
DataFrame,
68
Index,
@@ -12,6 +14,7 @@
1214
import pandas._testing as tm
1315

1416

17+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
1518
@pytest.mark.parametrize("other", [["three", "one", "two"], ["one"], ["one", "three"]])
1619
def test_join_level(idx, other, join_type):
1720
other = Index(other)

pandas/tests/indexes/object/test_indexing.py

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas._config import using_string_dtype
7+
68
from pandas._libs.missing import (
79
NA,
810
is_matching_na,
@@ -29,6 +31,7 @@ def test_get_indexer_strings(self, method, expected):
2931

3032
tm.assert_numpy_array_equal(actual, expected)
3133

34+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
3235
def test_get_indexer_strings_raises(self, using_infer_string):
3336
index = Index(["b", "c"])
3437

pandas/tests/indexes/test_base.py

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import numpy as np
99
import pytest
1010

11+
from pandas._config import using_string_dtype
12+
1113
from pandas.compat import IS64
1214
from pandas.errors import InvalidIndexError
1315
import pandas.util._test_decorators as td
@@ -71,6 +73,7 @@ def test_constructor_casting(self, index):
7173
tm.assert_contains_all(arr, new_index)
7274
tm.assert_index_equal(index, new_index)
7375

76+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
7477
def test_constructor_copy(self, using_infer_string):
7578
index = Index(list("abc"), name="name")
7679
arr = np.array(index)
@@ -335,6 +338,7 @@ def test_constructor_empty_special(self, empty, klass):
335338
def test_view_with_args(self, index):
336339
index.view("i8")
337340

341+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
338342
@pytest.mark.parametrize(
339343
"index",
340344
[
@@ -817,6 +821,7 @@ def test_isin(self, values, index, expected):
817821
expected = np.array(expected, dtype=bool)
818822
tm.assert_numpy_array_equal(result, expected)
819823

824+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
820825
def test_isin_nan_common_object(
821826
self, nulls_fixture, nulls_fixture2, using_infer_string
822827
):

pandas/tests/io/formats/style/test_bar.py

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def test_styler_bar_with_NA_values():
347347

348348

349349
def test_style_bar_with_pyarrow_NA_values():
350+
pytest.importorskip("pyarrow")
350351
data = """name,age,test1,test2,teacher
351352
Adam,15,95.0,80,Ashby
352353
Bob,16,81.0,82,Ashby

0 commit comments

Comments
 (0)