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

Function test_array_called

numpy/core/tests/test_protocols.py:34–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33
34def test_array_called():
35 class Wrapper:
36 val = '0' * 100
37 def __array__(self, result=None):
38 return np.array([self.val], dtype=object)
39
40
41 wrapped = Wrapper()
42 arr = np.array(wrapped, dtype=str)
43 assert arr.dtype == 'U100'
44 assert arr[0] == Wrapper.val

Callers

nothing calls this directly

Calls 1

WrapperClass · 0.85

Tested by

no test coverage detected