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

Function test_where_bool_optimization

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

Source from the content-addressed store, hash-verified

1878
1879
1880def test_where_bool_optimization():
1881 rng = np.random.default_rng()
1882 x = rng.integers(10, size=(15, 16))
1883 d = da.from_array(x, chunks=(4, 5))
1884 y = rng.integers(10, size=(15, 16))
1885 e = da.from_array(y, chunks=(4, 5))
1886
1887 for c in [True, False, np.True_, np.False_, 1, 0]:
1888 w1 = da.where(c, d, e)
1889 w2 = np.where(c, x, y)
1890
1891 assert_eq(w1, w2)
1892
1893 ex_w1 = d if c else e
1894
1895 assert w1 is ex_w1
1896
1897
1898def 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