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

Function test_from_array_scalar

dask/array/tests/test_array_core.py:2938–2952  ·  view source on GitHub ↗

Python and numpy scalars are automatically converted to ndarray

(type_)

Source from the content-addressed store, hash-verified

2936
2937@pytest.mark.parametrize("type_", [t for t in np.ScalarType if t is not memoryview])
2938def test_from_array_scalar(type_):
2939 """Python and numpy scalars are automatically converted to ndarray"""
2940 if type_ is np.datetime64:
2941 x = np.datetime64("2000-01-01")
2942 elif type_ is np.timedelta64:
2943 x = np.timedelta64(1, "s")
2944 else:
2945 x = type_(1)
2946
2947 dx = da.from_array(x, chunks=-1)
2948 assert_eq(np.array(x), dx)
2949 assert isinstance(
2950 dx.dask[dx.name,],
2951 np.ndarray,
2952 )
2953
2954
2955@pytest.mark.parametrize("asarray,cls", [(True, np.ndarray), (False, np.matrix)])

Callers

nothing calls this directly

Calls 1

assert_eqFunction · 0.90

Tested by

no test coverage detected