Skip to content

Commit

Permalink
TST: add regression tests for issue gh-540
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Dec 18, 2024
1 parent 1345afb commit 196685d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion unyt/tests/test_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from numpy.testing import assert_allclose
from packaging.version import Version

from unyt import A, K, cm, degC, delta_degC, g, km, rad, s
from unyt import A, K, Msun, cm, degC, delta_degC, g, km, rad, s
from unyt._array_functions import (
_HANDLED_FUNCTIONS as HANDLED_FUNCTIONS,
_UNSUPPORTED_FUNCTIONS as UNSUPPORTED_FUNCTIONS,
Expand Down Expand Up @@ -831,6 +831,12 @@ def test_histogramdd_with_weights_and_dimless_arr(self):
assert not hasattr(ywbins2, "units")
assert not hasattr(zwbins2, "units")

@pytest.mark.parametrize("weights", [None, [0, 1, 2], [0, 1, 2] * cm])
def test_histogramdd_recursion(self, weights):
# regression test for https://github.com/yt-project/unyt/issues/540
sample = [unyt_array(np.arange(3), Msun)]
np.histogramdd(sample, density=True, weights=weights)

def test_histogram_bin_edges(self):
rng = np.random.default_rng()
arr = rng.normal(size=1000) * cm
Expand Down

0 comments on commit 196685d

Please sign in to comment.