MCPcopy
hub / github.com/numpy/numpy / test_interface_nullptr

Function test_interface_nullptr

numpy/_core/tests/test_multiarray.py:9693–9705  ·  view source on GitHub ↗
(iface)

Source from the content-addressed store, hash-verified

9691 {"typestr": "(0,)f8,", "shape": (1, 3)},
9692])
9693def test_interface_nullptr(iface):
9694 iface.update({"data": (0, True)})
9695
9696 class ArrayLike:
9697 __array_interface__ = iface
9698
9699 arr = np.asarray(ArrayLike())
9700 # Note, we currently set the base anyway, but we do an allocation
9701 # (because NumPy doesn't like NULL data pointers everywhere).
9702 assert arr.shape == iface["shape"]
9703 assert arr.dtype == np.dtype(iface["typestr"])
9704 assert arr.base is not None
9705 assert arr.flags.owndata
9706
9707
9708def test_interface_nullptr_size_check():

Callers

nothing calls this directly

Calls 3

updateMethod · 0.80
ArrayLikeClass · 0.70
dtypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…