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

Method test_array_ufunc_direct_call

numpy/core/tests/test_umath.py:3941–3953  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3939 assert_(a.info, {'inputs': [0, 2]})
3940
3941 def test_array_ufunc_direct_call(self):
3942 # This is mainly a regression test for gh-24023 (shouldn't segfault)
3943 a = np.array(1)
3944 with pytest.raises(TypeError):
3945 a.__array_ufunc__()
3946
3947 # No kwargs means kwargs may be NULL on the C-level
3948 with pytest.raises(TypeError):
3949 a.__array_ufunc__(1, 2)
3950
3951 # And the same with a valid call:
3952 res = a.__array_ufunc__(np.add, "__call__", a, a)
3953 assert_array_equal(res, a + a)
3954
3955class TestChoose:
3956 def test_mixed(self):

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
__array_ufunc__Method · 0.45

Tested by

no test coverage detected