Skip to content

Commit 6b3618d

Browse files
authored
TST: skips in extension.test_categorical (#39062)
1 parent 52eb0d0 commit 6b3618d

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

pandas/tests/extension/base/methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def test_hash_pandas_object_works(self, data, as_frame):
399399
)
400400
def test_searchsorted(self, data_for_sorting, as_series):
401401
b, c, a = data_for_sorting
402-
arr = type(data_for_sorting)._from_sequence([a, b, c])
402+
arr = data_for_sorting.take([2, 0, 1]) # to get [a, b, c]
403403

404404
if as_series:
405405
arr = pd.Series(arr)

pandas/tests/extension/test_categorical.py

+17-16
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ def test_combine_add(self, data_repeated):
175175
def test_fillna_length_mismatch(self, data_missing):
176176
super().test_fillna_length_mismatch(data_missing)
177177

178-
def test_searchsorted(self, data_for_sorting):
179-
if not data_for_sorting.ordered:
180-
raise pytest.skip(reason="searchsorted requires ordered data.")
181-
182178

183179
class TestCasting(base.BaseCastingTests):
184180
@pytest.mark.parametrize("cls", [Categorical, CategoricalIndex])
@@ -229,21 +225,26 @@ def test_consistent_casting(self, dtype, expected):
229225

230226

231227
class TestArithmeticOps(base.BaseArithmeticOpsTests):
232-
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators):
228+
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
233229
# frame & scalar
234230
op_name = all_arithmetic_operators
235-
if op_name != "__rmod__":
236-
super().test_arith_frame_with_scalar(data, all_arithmetic_operators)
237-
else:
238-
pytest.skip("rmod never called when string is first argument")
239-
240-
def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
241-
231+
if op_name == "__rmod__":
232+
request.node.add_marker(
233+
pytest.mark.xfail(
234+
reason="rmod never called when string is first argument"
235+
)
236+
)
237+
super().test_arith_frame_with_scalar(data, op_name)
238+
239+
def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request):
242240
op_name = all_arithmetic_operators
243-
if op_name != "__rmod__":
244-
super().test_arith_series_with_scalar(data, op_name)
245-
else:
246-
pytest.skip("rmod never called when string is first argument")
241+
if op_name == "__rmod__":
242+
request.node.add_marker(
243+
pytest.mark.xfail(
244+
reason="rmod never called when string is first argument"
245+
)
246+
)
247+
super().test_arith_series_with_scalar(data, op_name)
247248

248249
def test_add_series_with_extension_array(self, data):
249250
ser = pd.Series(data)

0 commit comments

Comments
 (0)