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

Function test_view

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

Source from the content-addressed store, hash-verified

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