From 758d6680b6fc245aca94a20e12a3717af32795d1 Mon Sep 17 00:00:00 2001 From: Brock Date: Sun, 3 Jan 2021 10:50:28 -0800 Subject: [PATCH 1/2] TST: stricten xfails --- .../tests/arrays/sparse/test_arithmetics.py | 20 +++---------------- pandas/tests/frame/test_arithmetic.py | 14 ++++++++++--- pandas/tests/indexes/test_common.py | 7 +------ 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/pandas/tests/arrays/sparse/test_arithmetics.py b/pandas/tests/arrays/sparse/test_arithmetics.py index 61f4e3e50d09d..4eb6467c5809c 100644 --- a/pandas/tests/arrays/sparse/test_arithmetics.py +++ b/pandas/tests/arrays/sparse/test_arithmetics.py @@ -118,15 +118,10 @@ def _check_logical_ops(self, a, b, a_dense, b_dense): @pytest.mark.parametrize("scalar", [0, 1, 3]) @pytest.mark.parametrize("fill_value", [None, 0, 2]) def test_float_scalar( - self, kind, mix, all_arithmetic_functions, fill_value, scalar, request + self, kind, mix, all_arithmetic_functions, fill_value, scalar ): op = all_arithmetic_functions - if not _np_version_under1p20: - if op in [operator.floordiv, ops.rfloordiv]: - mark = pytest.mark.xfail(strict=False, reason="GH#38172") - request.node.add_marker(mark) - values = self._base([np.nan, 1, 2, 0, np.nan, 0, 1, 2, 1, np.nan]) a = self._klass(values, kind=kind, fill_value=fill_value) @@ -150,9 +145,7 @@ def test_float_scalar_comparison(self, kind): self._check_comparison_ops(a, 0, values, 0) self._check_comparison_ops(a, 3, values, 3) - def test_float_same_index_without_nans( - self, kind, mix, all_arithmetic_functions, request - ): + def test_float_same_index_without_nans(self, kind, mix, all_arithmetic_functions): # when sp_index are the same op = all_arithmetic_functions @@ -163,17 +156,10 @@ def test_float_same_index_without_nans( b = self._klass(rvalues, kind=kind, fill_value=0) self._check_numeric_ops(a, b, values, rvalues, mix, op) - def test_float_same_index_with_nans( - self, kind, mix, all_arithmetic_functions, request - ): + def test_float_same_index_with_nans(self, kind, mix, all_arithmetic_functions): # when sp_index are the same op = all_arithmetic_functions - if not _np_version_under1p20: - if op in [operator.floordiv, ops.rfloordiv]: - mark = pytest.mark.xfail(strict=False, reason="GH#38172") - request.node.add_marker(mark) - values = self._base([np.nan, 1, 2, 0, np.nan, 0, 1, 2, 1, np.nan]) rvalues = self._base([np.nan, 2, 3, 4, np.nan, 0, 1, 3, 2, np.nan]) diff --git a/pandas/tests/frame/test_arithmetic.py b/pandas/tests/frame/test_arithmetic.py index e6d1cd5f47d8d..22eb642ed8512 100644 --- a/pandas/tests/frame/test_arithmetic.py +++ b/pandas/tests/frame/test_arithmetic.py @@ -821,7 +821,6 @@ def test_frame_with_frame_reindex(self): (np.datetime64(20, "ns"), " Date: Sun, 3 Jan 2021 17:20:29 -0800 Subject: [PATCH 2/2] revert sparse --- .../tests/arrays/sparse/test_arithmetics.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pandas/tests/arrays/sparse/test_arithmetics.py b/pandas/tests/arrays/sparse/test_arithmetics.py index 4eb6467c5809c..61f4e3e50d09d 100644 --- a/pandas/tests/arrays/sparse/test_arithmetics.py +++ b/pandas/tests/arrays/sparse/test_arithmetics.py @@ -118,10 +118,15 @@ def _check_logical_ops(self, a, b, a_dense, b_dense): @pytest.mark.parametrize("scalar", [0, 1, 3]) @pytest.mark.parametrize("fill_value", [None, 0, 2]) def test_float_scalar( - self, kind, mix, all_arithmetic_functions, fill_value, scalar + self, kind, mix, all_arithmetic_functions, fill_value, scalar, request ): op = all_arithmetic_functions + if not _np_version_under1p20: + if op in [operator.floordiv, ops.rfloordiv]: + mark = pytest.mark.xfail(strict=False, reason="GH#38172") + request.node.add_marker(mark) + values = self._base([np.nan, 1, 2, 0, np.nan, 0, 1, 2, 1, np.nan]) a = self._klass(values, kind=kind, fill_value=fill_value) @@ -145,7 +150,9 @@ def test_float_scalar_comparison(self, kind): self._check_comparison_ops(a, 0, values, 0) self._check_comparison_ops(a, 3, values, 3) - def test_float_same_index_without_nans(self, kind, mix, all_arithmetic_functions): + def test_float_same_index_without_nans( + self, kind, mix, all_arithmetic_functions, request + ): # when sp_index are the same op = all_arithmetic_functions @@ -156,10 +163,17 @@ def test_float_same_index_without_nans(self, kind, mix, all_arithmetic_functions b = self._klass(rvalues, kind=kind, fill_value=0) self._check_numeric_ops(a, b, values, rvalues, mix, op) - def test_float_same_index_with_nans(self, kind, mix, all_arithmetic_functions): + def test_float_same_index_with_nans( + self, kind, mix, all_arithmetic_functions, request + ): # when sp_index are the same op = all_arithmetic_functions + if not _np_version_under1p20: + if op in [operator.floordiv, ops.rfloordiv]: + mark = pytest.mark.xfail(strict=False, reason="GH#38172") + request.node.add_marker(mark) + values = self._base([np.nan, 1, 2, 0, np.nan, 0, 1, 2, 1, np.nan]) rvalues = self._base([np.nan, 2, 3, 4, np.nan, 0, 1, 3, 2, np.nan])