MCPcopy
hub / github.com/dask/dask / test_view

Function test_view

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

Source from the content-addressed store, hash-verified

3577
3578
3579def test_view():
3580 x = np.arange(56).reshape((7, 8))
3581 d = da.from_array(x, chunks=(2, 3))
3582
3583 assert_eq(x.view(), d.view())
3584 assert_eq(x.view("i4"), d.view("i4"))
3585 assert_eq(x.view("i2"), d.view("i2"))
3586 assert all(isinstance(s, int) for s in d.shape)
3587
3588 x = np.arange(8, dtype="i1")
3589 d = da.from_array(x, chunks=(4,))
3590 assert_eq(x.view("i4"), d.view("i4"))
3591
3592 with pytest.raises(ValueError):
3593 x = np.arange(8, dtype="i1")
3594 d = da.from_array(x, chunks=(3,))
3595 d.view("i4")
3596
3597 with pytest.raises(ValueError):
3598 d.view("i4", order="asdf")
3599
3600
3601def 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…