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

Function test_array_interface_offset

numpy/core/tests/test_multiarray.py:8621–8633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8619 assert_equal(arr1, arr3)
8620
8621def test_array_interface_offset():
8622 arr = np.array([1, 2, 3], dtype='int32')
8623 interface = dict(arr.__array_interface__)
8624 interface['data'] = memoryview(arr)
8625 interface['shape'] = (2,)
8626 interface['offset'] = 4
8627
8628
8629 class DummyArray:
8630 __array_interface__ = interface
8631
8632 arr1 = np.asarray(DummyArray())
8633 assert_equal(arr1, arr[1:])
8634
8635def test_array_interface_unicode_typestr():
8636 arr = np.array([1, 2, 3], dtype='int32')

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
DummyArrayClass · 0.70

Tested by

no test coverage detected