Skip to content

Commit c102edc

Browse files
committed
TEST: Relocate unit test to a more sensible location, test both Index and
Series compat
1 parent 1cd46e9 commit c102edc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pandas/tests/reductions/test_reductions.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@ def test_min_max_categorical(self):
550550
assert ci.min() == "c"
551551
assert ci.max() == "b"
552552

553-
def test_numpy_any_all(self):
554-
idx = Index([0, 1, 2])
555-
assert not np.all(idx)
556-
assert np.any(idx)
557-
idx = Index([1, 2, 3])
558-
assert np.all(idx)
559-
560553

561554
class TestSeriesReductions:
562555
# Note: the name TestSeriesReductions indicates these tests
@@ -905,6 +898,15 @@ def test_all_any(self):
905898
s = Series(["abc", True])
906899
assert "abc" == s.any() # 'abc' || True => 'abc'
907900

901+
@pytest.mark.parametrize("klass", [Index, Series])
902+
def test_numpy_all_any(self, klass):
903+
# GH#40180
904+
idx = klass([0, 1, 2])
905+
assert not np.all(idx)
906+
assert np.any(idx)
907+
idx = Index([1, 2, 3])
908+
assert np.all(idx)
909+
908910
def test_all_any_params(self):
909911
# Check skipna, with implicit 'object' dtype.
910912
s1 = Series([np.nan, True])

0 commit comments

Comments
 (0)