MCPcopy Create free account
hub / github.com/dask/dask / test_histogram

Function test_histogram

dask/array/tests/test_routines.py:757–769  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

755
756
757def test_histogram():
758 # Test for normal, flattened input
759 n = 100
760 v = da.random.default_rng().random(n, chunks=10)
761 bins = np.arange(0, 1.01, 0.01)
762 a1, b1 = da.histogram(v, bins=bins)
763 a2, b2 = np.histogram(v, bins=bins)
764
765 # Check if the sum of the bins equals the number of samples
766 assert a2.sum(axis=0) == n
767 assert a1.sum(axis=0) == n
768 assert_eq(a1, a2)
769 assert same_keys(da.histogram(v, bins=bins)[0], a1)
770
771
772def test_histogram_alternative_bins_range():

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
same_keysFunction · 0.90
randomMethod · 0.45
arangeMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected