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

Function test_view

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

Source from the content-addressed store, hash-verified

3570
3571
3572def test_view():
3573 x = np.arange(56).reshape((7, 8))
3574 d = da.from_array(x, chunks=(2, 3))
3575
3576 assert_eq(x.view(), d.view())
3577 assert_eq(x.view("i4"), d.view("i4"))
3578 assert_eq(x.view("i2"), d.view("i2"))
3579 assert all(isinstance(s, int) for s in d.shape)
3580
3581 x = np.arange(8, dtype="i1")
3582 d = da.from_array(x, chunks=(4,))
3583 assert_eq(x.view("i4"), d.view("i4"))
3584
3585 with pytest.raises(ValueError):
3586 x = np.arange(8, dtype="i1")
3587 d = da.from_array(x, chunks=(3,))
3588 d.view("i4")
3589
3590 with pytest.raises(ValueError):
3591 d.view("i4", order="asdf")
3592
3593
3594def test_view_fortran():

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
allFunction · 0.85
reshapeMethod · 0.80
viewMethod · 0.80
arangeMethod · 0.45

Tested by

no test coverage detected