diff --git a/tests/test_core.py b/tests/test_core.py index e12e695d..e9c5ebec 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -613,6 +613,33 @@ def test_dask_reduce_axis_subset(): ) +@pytest.mark.parametrize( + "func", + [ + # "first", "last", + "nanfirst", + "nanlast", + ], +) +@pytest.mark.parametrize( + "chunks", + [ + None, + pytest.param(1, marks=pytest.mark.skipif(not has_dask, reason="no dask")), + pytest.param(2, marks=pytest.mark.skipif(not has_dask, reason="no dask")), + pytest.param(3, marks=pytest.mark.skipif(not has_dask, reason="no dask")), + ], +) +def test_first_last_useless(func, chunks): + array = np.array([[0, 0, 0], [0, 0, 0]], dtype=np.int8) + group_idx = np.array([1, 0, 0]) + if chunks is not None: + array = dask.array.from_array(array, chunks=chunks) + actual, _ = groupby_reduce(array, group_idx, func=func, engine="numpy") + expected = np.array([[0, 0], [0, 0]], dtype=np.int8) + assert_equal(actual, expected) + + @pytest.mark.parametrize("func", ["first", "last", "nanfirst", "nanlast"]) @pytest.mark.parametrize("axis", [(0, 1)]) def test_first_last_disallowed(axis, func):