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

Method _check_roundtrip

numpy/core/tests/test_multiarray.py:7828–7842  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

7826 """ Test PEP3118 buffers """
7827
7828 def _check_roundtrip(self, obj):
7829 obj = np.asarray(obj)
7830 x = memoryview(obj)
7831 y = np.asarray(x)
7832 y2 = np.array(x)
7833 assert_(not y.flags.owndata)
7834 assert_(y2.flags.owndata)
7835
7836 assert_equal(y.dtype, obj.dtype)
7837 assert_equal(y.shape, obj.shape)
7838 assert_array_equal(obj, y)
7839
7840 assert_equal(y2.dtype, obj.dtype)
7841 assert_equal(y2.shape, obj.shape)
7842 assert_array_equal(obj, y2)
7843
7844 def test_roundtrip(self):
7845 x = np.array([1, 2, 3, 4, 5], dtype='i4')

Callers 7

test_roundtripMethod · 0.95
test_roundtrip_halfMethod · 0.95
test_roundtrip_scalarMethod · 0.95
test_paddingMethod · 0.95
test_max_dimsMethod · 0.95

Calls 3

assert_Function · 0.90
assert_equalFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected