diff --git a/pandas/tests/extension/base/methods.py b/pandas/tests/extension/base/methods.py index 472e783c977f0..7e7f1f1a6e025 100644 --- a/pandas/tests/extension/base/methods.py +++ b/pandas/tests/extension/base/methods.py @@ -394,7 +394,7 @@ def test_hash_pandas_object_works(self, data, as_frame): def test_searchsorted(self, data_for_sorting, as_series): b, c, a = data_for_sorting - arr = type(data_for_sorting)._from_sequence([a, b, c]) + arr = data_for_sorting.take([2, 0, 1]) # to get [a, b, c] if as_series: arr = pd.Series(arr) diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index e38de67071f15..9cea274a118c0 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -175,10 +175,6 @@ def test_combine_add(self, data_repeated): def test_fillna_length_mismatch(self, data_missing): super().test_fillna_length_mismatch(data_missing) - def test_searchsorted(self, data_for_sorting): - if not data_for_sorting.ordered: - raise pytest.skip(reason="searchsorted requires ordered data.") - class TestCasting(base.BaseCastingTests): @pytest.mark.parametrize("cls", [Categorical, CategoricalIndex]) @@ -229,21 +225,26 @@ def test_consistent_casting(self, dtype, expected): class TestArithmeticOps(base.BaseArithmeticOpsTests): - def test_arith_frame_with_scalar(self, data, all_arithmetic_operators): + def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request): # frame & scalar op_name = all_arithmetic_operators - if op_name != "__rmod__": - super().test_arith_frame_with_scalar(data, all_arithmetic_operators) - else: - pytest.skip("rmod never called when string is first argument") - - def test_arith_series_with_scalar(self, data, all_arithmetic_operators): - + if op_name == "__rmod__": + request.node.add_marker( + pytest.mark.xfail( + reason="rmod never called when string is first argument" + ) + ) + super().test_arith_frame_with_scalar(data, op_name) + + def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request): op_name = all_arithmetic_operators - if op_name != "__rmod__": - super().test_arith_series_with_scalar(data, op_name) - else: - pytest.skip("rmod never called when string is first argument") + if op_name == "__rmod__": + request.node.add_marker( + pytest.mark.xfail( + reason="rmod never called when string is first argument" + ) + ) + super().test_arith_series_with_scalar(data, op_name) def test_add_series_with_extension_array(self, data): ser = pd.Series(data)