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

Function test_where_bool_optimization

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

Source from the content-addressed store, hash-verified

1978
1979
1980def test_where_bool_optimization():
1981 rng = np.random.default_rng()
1982 x = rng.integers(10, size=(15, 16))
1983 d = da.from_array(x, chunks=(4, 5))
1984 y = rng.integers(10, size=(15, 16))
1985 e = da.from_array(y, chunks=(4, 5))
1986
1987 for c in [True, False, np.True_, np.False_, 1, 0]:
1988 w1 = da.where(c, d, e)
1989 w2 = np.where(c, x, y)
1990
1991 assert_eq(w1, w2)
1992
1993 ex_w1 = d if c else e
1994
1995 assert w1 is ex_w1
1996
1997
1998def test_where_nonzero():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
integersMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…