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

Function test_reductions_with_empty_array

dask/array/tests/test_reductions.py:552–565  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

550
551
552def test_reductions_with_empty_array():
553 dx1 = da.ones((10, 0, 5), chunks=4)
554 x1 = dx1.compute()
555 dx2 = da.ones((0, 0, 0), chunks=4)
556 x2 = dx2.compute()
557
558 for dx, x in [(dx1, x1), (dx2, x2)]:
559 with warnings.catch_warnings():
560 warnings.simplefilter("ignore", RuntimeWarning) # Mean of empty slice
561 assert_eq(dx.mean(), x.mean())
562 assert_eq(dx.mean(axis=()), x.mean(axis=()))
563 assert_eq(dx.mean(axis=0), x.mean(axis=0))
564 assert_eq(dx.mean(axis=1), x.mean(axis=1))
565 assert_eq(dx.mean(axis=2), x.mean(axis=2))
566
567
568def assert_max_deps(x, n, eq=True):

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
onesMethod · 0.45
computeMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected