From 9c34ca0b9a6b5cbc77e0681f0c72e7c70a603033 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 19 Jun 2024 11:47:55 +0200 Subject: [PATCH 1/2] fix: dtype of np.sum boolean arrays --- tests/test_0115_generic_reducer_operation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_0115_generic_reducer_operation.py b/tests/test_0115_generic_reducer_operation.py index 3c23d5f3a2..d9af761d3e 100644 --- a/tests/test_0115_generic_reducer_operation.py +++ b/tests/test_0115_generic_reducer_operation.py @@ -1411,6 +1411,9 @@ def test_sumprod_types_FIXME(): content2 = ak.contents.NumpyArray(array.reshape(-1)) offsets3 = ak.index.Index64(np.array([0, 3, 3, 5, 6], dtype=np.int64)) depth1 = ak.contents.ListOffsetArray(offsets3, content2) + + numpy_sum = np.sum(array, axis=-1).astype(np.int64) + assert ( np.sum(array, axis=-1).dtype == ak.to_numpy(ak.sum(depth1, axis=-1, highlevel=False)).dtype @@ -1433,6 +1436,8 @@ def prod(xs): offsets3 = ak.index.Index64(np.array([0, 3, 3, 5, 6], dtype=np.int64)) depth1 = ak.contents.ListOffsetArray(offsets3, content2) + numpy_sum = np.sum(array, axis=-1).astype(np.int64) + assert sum(to_list(np.sum(array, axis=-1))) == sum( to_list(ak.sum(depth1, axis=-1, highlevel=False)) ) From f8d0935a286a08fa0884fa600c72eb55037ba83b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:48:21 +0000 Subject: [PATCH 2/2] style: pre-commit fixes --- tests/test_0115_generic_reducer_operation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_0115_generic_reducer_operation.py b/tests/test_0115_generic_reducer_operation.py index d9af761d3e..17813c42d0 100644 --- a/tests/test_0115_generic_reducer_operation.py +++ b/tests/test_0115_generic_reducer_operation.py @@ -1411,9 +1411,9 @@ def test_sumprod_types_FIXME(): content2 = ak.contents.NumpyArray(array.reshape(-1)) offsets3 = ak.index.Index64(np.array([0, 3, 3, 5, 6], dtype=np.int64)) depth1 = ak.contents.ListOffsetArray(offsets3, content2) - + numpy_sum = np.sum(array, axis=-1).astype(np.int64) - + assert ( np.sum(array, axis=-1).dtype == ak.to_numpy(ak.sum(depth1, axis=-1, highlevel=False)).dtype