Skip to content

Commit

Permalink
add a multiarg test
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Dec 18, 2024
1 parent 7192b54 commit c9b9596
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c9b9596

Please sign in to comment.