From c9b95966974f0eac4ca3a0bbf81dedfb360db683 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Wed, 18 Dec 2024 09:48:49 -0600 Subject: [PATCH] add a multiarg test --- tests/test_boost.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/test_boost.py b/tests/test_boost.py index a0c1ed2..a2c93d2 100644 --- a/tests/test_boost.py +++ b/tests/test_boost.py @@ -602,3 +602,37 @@ def test_155_2(): assert np.all( hist.values() == [0.0, 3.0, 6.0, 9.0, 12.0, 15.0, 18.0, 21.0, 24.0, 27.0] ) + + +def test_155_3_2d(): + import boost_histogram as bh + + dak = pytest.importorskip("dask_awkward") + + import dask_histogram as dh + + arr1 = dak.from_lists([list(range(10))] * 3) + arr2 = dak.from_lists([list(reversed(range(10)))] * 3) + axis1 = bh.axis.Regular(10, 0.0, 10.0) + axis2 = bh.axis.Regular(10, 0.0, 10.0) + hist = dh.factory( + arr1, + arr2, + axes=(axis1, axis2), + weights=arr1, + ).compute() + should_be = ( + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 9.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 15.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 21.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 24.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [27.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + ) + assert np.all(hist.values() == should_be)