MCPcopy
hub / github.com/dask/dask / test_coerce

Function test_coerce

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

setMethod · 0.80
funcFunction · 0.70
arangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…