From 0b93cd4996282763307c6e11bd0a9b7e8d420b5f Mon Sep 17 00:00:00 2001 From: Linxiao Wu Date: Mon, 6 Apr 2020 22:53:43 -0400 Subject: [PATCH] add testcase similar to test_all_any_params related to issue #33253 --- pandas/tests/reductions/test_reductions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pandas/tests/reductions/test_reductions.py b/pandas/tests/reductions/test_reductions.py index 962b105d1e8fc..0549f06103a28 100644 --- a/pandas/tests/reductions/test_reductions.py +++ b/pandas/tests/reductions/test_reductions.py @@ -863,6 +863,20 @@ def test_all_any_params(self): with pytest.raises(NotImplementedError): s.all(bool_only=True) + def test_all_any_boolean(self): + # Check skipna, with boolean type + s1 = Series([pd.NA, True], dtype="boolean") + s2 = Series([pd.NA, False], dtype="boolean") + assert pd.isna(s1.all(skipna=False)) # NA && True => NA + assert s1.all(skipna=True) + assert pd.isna(s2.any(skipna=False)) # NA || False => NA + assert not s2.any(skipna=True) + # GH-33253: all True / all False values buggy with skipna=False + s3 = Series([True, True], dtype="boolean") + s4 = Series([False, False], dtype="boolean") + assert s3.all(skipna=False) + assert not s4.any(skipna=False) + def test_timedelta64_analytics(self): # index min/max