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

Function test_coerce

dask/array/tests/test_array_core.py:2038–2051  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2036
2037
2038def test_coerce():
2039 d0 = da.from_array(np.array(1), chunks=(1,))
2040 d1 = da.from_array(np.array([1]), chunks=(1,))
2041 with dask.config.set(scheduler="sync"):
2042 for d in d0, d1:
2043 assert bool(d) is True
2044 assert int(d) == 1
2045 assert float(d) == 1.0
2046 assert complex(d) == complex(1)
2047
2048 a2 = np.arange(2)
2049 d2 = da.from_array(a2, chunks=(2,))
2050 for func in (int, float, complex):
2051 pytest.raises(TypeError, lambda func=func: func(d2))
2052
2053
2054def test_bool():

Callers

nothing calls this directly

Calls 3

setMethod · 0.80
funcFunction · 0.70
arangeMethod · 0.45

Tested by

no test coverage detected