Skip to content

Commit 756c724

Browse files
committed
Add more first, last tests
1 parent 8f7d093 commit 756c724

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/test_core.py

+27
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,33 @@ def test_dask_reduce_axis_subset():
613613
)
614614

615615

616+
@pytest.mark.parametrize(
617+
"func",
618+
[
619+
# "first", "last",
620+
"nanfirst",
621+
"nanlast",
622+
],
623+
)
624+
@pytest.mark.parametrize(
625+
"chunks",
626+
[
627+
None,
628+
pytest.param(1, marks=pytest.mark.skipif(not has_dask, reason="no dask")),
629+
pytest.param(2, marks=pytest.mark.skipif(not has_dask, reason="no dask")),
630+
pytest.param(3, marks=pytest.mark.skipif(not has_dask, reason="no dask")),
631+
],
632+
)
633+
def test_first_last_useless(func, chunks):
634+
array = np.array([[0, 0, 0], [0, 0, 0]], dtype=np.int8)
635+
group_idx = np.array([1, 0, 0])
636+
if chunks is not None:
637+
array = dask.array.from_array(array, chunks=chunks)
638+
actual, _ = groupby_reduce(array, group_idx, func=func, engine="numpy")
639+
expected = np.array([[0, 0], [0, 0]], dtype=np.int8)
640+
assert_equal(actual, expected)
641+
642+
616643
@pytest.mark.parametrize("func", ["first", "last", "nanfirst", "nanlast"])
617644
@pytest.mark.parametrize("axis", [(0, 1)])
618645
def test_first_last_disallowed(axis, func):

0 commit comments

Comments
 (0)