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

Method test_interface

numpy/core/tests/test_overrides.py:219–232  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

217 assert_equal(dispatched_one_arg.__doc__, 'Docstring.')
218
219 def test_interface(self):
220
221 class MyArray:
222 def __array_function__(self, func, types, args, kwargs):
223 return (self, func, types, args, kwargs)
224
225 original = MyArray()
226 (obj, func, types, args, kwargs) = dispatched_one_arg(original)
227 assert_(obj is original)
228 assert_(func is dispatched_one_arg)
229 assert_equal(set(types), {MyArray})
230 # assert_equal uses the overloaded np.iscomplexobj() internally
231 assert_(args == (original,))
232 assert_equal(kwargs, {})
233
234 def test_not_implemented(self):
235

Callers

nothing calls this directly

Calls 4

assert_Function · 0.90
assert_equalFunction · 0.90
dispatched_one_argFunction · 0.85
MyArrayClass · 0.70

Tested by

no test coverage detected