From 92d84150d70c372f50a5bebe84759f96c1d5896f Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 1 May 2020 13:34:14 -0700 Subject: [PATCH 1/2] remove xfails --- pandas/tests/test_strings.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index 35786ce64ac15..caae3b7e35076 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -209,19 +209,8 @@ def test_api_per_dtype(self, index_or_series, dtype, any_skipna_inferred_dtype): box = index_or_series inferred_dtype, values = any_skipna_inferred_dtype - if dtype == "category" and len(values) and values[1] is pd.NA: - pytest.xfail(reason="Categorical does not yet support pd.NA") - t = box(values, dtype=dtype) # explicit dtype to avoid casting - # TODO: get rid of these xfails - if dtype == "category" and inferred_dtype in ["period", "interval"]: - pytest.xfail( - reason="Conversion to numpy array fails because " - "the ._values-attribute is not a numpy array for " - "PeriodArray/IntervalArray; see GH 23553" - ) - types_passing_constructor = [ "string", "unicode", From 843e7931618c85f50a4c6b8c0c42e98a9836de4f Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 1 May 2020 14:15:43 -0700 Subject: [PATCH 2/2] stricten test_string xfails --- pandas/tests/test_strings.py | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index caae3b7e35076..d9396d70f9112 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -236,6 +236,7 @@ def test_api_per_method( dtype, any_allowed_skipna_inferred_dtype, any_string_method, + request, ): # this test does not check correctness of the different methods, # just that the methods work on the specified (inferred) dtypes, @@ -247,26 +248,24 @@ def test_api_per_method( method_name, args, kwargs = any_string_method # TODO: get rid of these xfails - if ( - method_name in ["partition", "rpartition"] - and box == Index - and inferred_dtype == "empty" - ): - pytest.xfail(reason="Method cannot deal with empty Index") - if ( - method_name == "split" - and box == Index - and values.size == 0 - and kwargs.get("expand", None) is not None - ): - pytest.xfail(reason="Split fails on empty Series when expand=True") - if ( - method_name == "get_dummies" - and box == Index - and inferred_dtype == "empty" - and (dtype == object or values.size == 0) - ): - pytest.xfail(reason="Need to fortify get_dummies corner cases") + reason = None + if box is Index and values.size == 0: + if method_name in ["partition", "rpartition"] and kwargs.get( + "expand", True + ): + reason = "Method cannot deal with empty Index" + elif method_name == "split" and kwargs.get("expand", None): + reason = "Split fails on empty Series when expand=True" + elif method_name == "get_dummies": + reason = "Need to fortify get_dummies corner cases" + + elif box is Index and inferred_dtype == "empty" and dtype == object: + if method_name == "get_dummies": + reason = "Need to fortify get_dummies corner cases" + + if reason is not None: + mark = pytest.mark.xfail(reason=reason) + request.node.add_marker(mark) t = box(values, dtype=dtype) # explicit dtype to avoid casting method = getattr(t.str, method_name)