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

Method test_wrap

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

Source from the content-addressed store, hash-verified

2931
2932class TestSpecialMethods:
2933 def test_wrap(self):
2934
2935 class with_wrap:
2936 def __array__(self):
2937 return np.zeros(1)
2938
2939 def __array_wrap__(self, arr, context):
2940 r = with_wrap()
2941 r.arr = arr
2942 r.context = context
2943 return r
2944
2945 a = with_wrap()
2946 x = ncu.minimum(a, a)
2947 assert_equal(x.arr, np.zeros(1))
2948 func, args, i = x.context
2949 assert_(func is ncu.minimum)
2950 assert_equal(len(args), 2)
2951 assert_equal(args[0], a)
2952 assert_equal(args[1], a)
2953 assert_equal(i, 0)
2954
2955 def test_wrap_and_prepare_out(self):
2956 # Calling convention for out should not affect how special methods are

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_Function · 0.90
with_wrapClass · 0.85

Tested by

no test coverage detected