MCPcopy Create free account
hub / github.com/numpy/numpy / test_reshape_copy

Function test_reshape_copy

numpy/array_api/tests/test_manipulation_functions.py:25–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def test_reshape_copy():
26 a = asarray(np.ones((2, 3)))
27 b = reshape(a, (3, 2), copy=True)
28 assert not np.shares_memory(a._array, b._array)
29
30 a = asarray(np.ones((2, 3)))
31 b = reshape(a, (3, 2), copy=False)
32 assert np.shares_memory(a._array, b._array)
33
34 a = asarray(np.ones((2, 3)).T)
35 b = reshape(a, (3, 2), copy=True)
36 assert_raises(AttributeError, lambda: reshape(a, (2, 3), copy=False))
37

Callers

nothing calls this directly

Calls 3

assert_raisesFunction · 0.90
asarrayFunction · 0.50
reshapeFunction · 0.50

Tested by

no test coverage detected