From 9407e6c33cad1970bd58c1b6afca8cf597403dd0 Mon Sep 17 00:00:00 2001 From: phofl Date: Sun, 11 Apr 2021 14:56:34 +0200 Subject: [PATCH 1/3] Skipt failing tests for numpy dev --- .../tests/arrays/boolean/test_arithmetic.py | 5 +++- pandas/tests/arrays/masked/test_arithmetic.py | 7 +++++ pandas/tests/extension/test_boolean.py | 26 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arrays/boolean/test_arithmetic.py b/pandas/tests/arrays/boolean/test_arithmetic.py index f8f1af4c3da51..8e879372cba31 100644 --- a/pandas/tests/arrays/boolean/test_arithmetic.py +++ b/pandas/tests/arrays/boolean/test_arithmetic.py @@ -69,7 +69,10 @@ def test_div(left_array, right_array): @pytest.mark.parametrize( "opname", [ - "floordiv", + pytest.param( + "floordiv", + marks=pytest.mark.xfail(reason="NumpyDev GH#40874", strict=False), + ), "mod", pytest.param( "pow", marks=pytest.mark.xfail(reason="TODO follow int8 behaviour? GH34686") diff --git a/pandas/tests/arrays/masked/test_arithmetic.py b/pandas/tests/arrays/masked/test_arithmetic.py index adb52fce17f8b..92a93590d7d23 100644 --- a/pandas/tests/arrays/masked/test_arithmetic.py +++ b/pandas/tests/arrays/masked/test_arithmetic.py @@ -6,6 +6,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd import pandas._testing as tm from pandas.core.arrays import ExtensionArray @@ -52,6 +54,11 @@ def test_array_scalar_like_equivalence(data, all_arithmetic_operators): def test_array_NA(data, all_arithmetic_operators): if "truediv" in all_arithmetic_operators: pytest.skip("division with pd.NA raises") + if ( + "floordiv" in all_arithmetic_operators + or "rfloordiv" in all_arithmetic_operators + ) and is_numpy_dev: + pytest.skip("NumpyDev behavior GH#40874") data, _ = data op = tm.get_op_from_name(all_arithmetic_operators) check_skip(data, all_arithmetic_operators) diff --git a/pandas/tests/extension/test_boolean.py b/pandas/tests/extension/test_boolean.py index 33d82a1d64fb7..f6aa51a5058bc 100644 --- a/pandas/tests/extension/test_boolean.py +++ b/pandas/tests/extension/test_boolean.py @@ -16,6 +16,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd import pandas._testing as tm from pandas.core.arrays.boolean import BooleanDtype @@ -140,6 +142,30 @@ def _check_op(self, obj, op, other, op_name, exc=NotImplementedError): with pytest.raises(exc): op(obj, other) + def test_arith_series_with_scalar(self, data, all_arithmetic_operators): + if ( + "floordiv" in all_arithmetic_operators + or "rfloordiv" in all_arithmetic_operators + ) and is_numpy_dev: + pytest.skip("NumpyDev behavior GH#40874") + super().test_arith_series_with_scalar(data, all_arithmetic_operators) + + def test_arith_frame_with_scalar(self, data, all_arithmetic_operators): + if ( + "floordiv" in all_arithmetic_operators + or "rfloordiv" in all_arithmetic_operators + ) and is_numpy_dev: + pytest.skip("NumpyDev behavior GH#40874") + super().test_arith_frame_with_scalar(data, all_arithmetic_operators) + + def test_arith_series_with_array(self, data, all_arithmetic_operators): + if ( + "floordiv" in all_arithmetic_operators + or "rfloordiv" in all_arithmetic_operators + ) and is_numpy_dev: + pytest.skip("NumpyDev behavior GH#40874") + super().test_arith_series_with_scalar(data, all_arithmetic_operators) + def _check_divmod_op(self, s, op, other, exc=None): # override to not raise an error super()._check_divmod_op(s, op, other, None) From 98c930d58c826ca5d411a1dd17ecb8eae565e4e8 Mon Sep 17 00:00:00 2001 From: phofl Date: Sun, 11 Apr 2021 15:42:08 +0200 Subject: [PATCH 2/3] Add missed test to skip --- pandas/tests/extension/test_boolean.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/tests/extension/test_boolean.py b/pandas/tests/extension/test_boolean.py index f6aa51a5058bc..310f4429ab2f0 100644 --- a/pandas/tests/extension/test_boolean.py +++ b/pandas/tests/extension/test_boolean.py @@ -166,6 +166,11 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators): pytest.skip("NumpyDev behavior GH#40874") super().test_arith_series_with_scalar(data, all_arithmetic_operators) + def test_divmod_series_array(self, data, data_for_twos): + if is_numpy_dev: + pytest.skip("NumpyDev behavior GH#40874") + super().test_divmod_series_array(data, data_for_twos) + def _check_divmod_op(self, s, op, other, exc=None): # override to not raise an error super()._check_divmod_op(s, op, other, None) From 5aea40c677f8f8d8a270a0db19d63b660e37a3ea Mon Sep 17 00:00:00 2001 From: phofl Date: Sun, 11 Apr 2021 16:08:45 +0200 Subject: [PATCH 3/3] Change if condition --- pandas/tests/arrays/masked/test_arithmetic.py | 5 +---- pandas/tests/extension/test_boolean.py | 15 +++------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/pandas/tests/arrays/masked/test_arithmetic.py b/pandas/tests/arrays/masked/test_arithmetic.py index 92a93590d7d23..088a37f8615c0 100644 --- a/pandas/tests/arrays/masked/test_arithmetic.py +++ b/pandas/tests/arrays/masked/test_arithmetic.py @@ -54,10 +54,7 @@ def test_array_scalar_like_equivalence(data, all_arithmetic_operators): def test_array_NA(data, all_arithmetic_operators): if "truediv" in all_arithmetic_operators: pytest.skip("division with pd.NA raises") - if ( - "floordiv" in all_arithmetic_operators - or "rfloordiv" in all_arithmetic_operators - ) and is_numpy_dev: + if "floordiv" in all_arithmetic_operators and is_numpy_dev: pytest.skip("NumpyDev behavior GH#40874") data, _ = data op = tm.get_op_from_name(all_arithmetic_operators) diff --git a/pandas/tests/extension/test_boolean.py b/pandas/tests/extension/test_boolean.py index 310f4429ab2f0..23ab80f200598 100644 --- a/pandas/tests/extension/test_boolean.py +++ b/pandas/tests/extension/test_boolean.py @@ -143,26 +143,17 @@ def _check_op(self, obj, op, other, op_name, exc=NotImplementedError): op(obj, other) def test_arith_series_with_scalar(self, data, all_arithmetic_operators): - if ( - "floordiv" in all_arithmetic_operators - or "rfloordiv" in all_arithmetic_operators - ) and is_numpy_dev: + if "floordiv" in all_arithmetic_operators and is_numpy_dev: pytest.skip("NumpyDev behavior GH#40874") super().test_arith_series_with_scalar(data, all_arithmetic_operators) def test_arith_frame_with_scalar(self, data, all_arithmetic_operators): - if ( - "floordiv" in all_arithmetic_operators - or "rfloordiv" in all_arithmetic_operators - ) and is_numpy_dev: + if "floordiv" in all_arithmetic_operators and is_numpy_dev: pytest.skip("NumpyDev behavior GH#40874") super().test_arith_frame_with_scalar(data, all_arithmetic_operators) def test_arith_series_with_array(self, data, all_arithmetic_operators): - if ( - "floordiv" in all_arithmetic_operators - or "rfloordiv" in all_arithmetic_operators - ) and is_numpy_dev: + if "floordiv" in all_arithmetic_operators and is_numpy_dev: pytest.skip("NumpyDev behavior GH#40874") super().test_arith_series_with_scalar(data, all_arithmetic_operators)