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

Method test_wrap_with_iterable

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

Source from the content-addressed store, hash-verified

3008 do_test(lambda a: np.add(0, 0, a, where=False), lambda a: (0, 0, a))
3009
3010 def test_wrap_with_iterable(self):
3011 # test fix for bug #1026:
3012
3013 class with_wrap(np.ndarray):
3014 __array_priority__ = 10
3015
3016 def __new__(cls):
3017 return np.asarray(1).view(cls).copy()
3018
3019 def __array_wrap__(self, arr, context):
3020 return arr.view(type(self))
3021
3022 a = with_wrap()
3023 x = ncu.multiply(a, (1, 2, 3))
3024 assert_(isinstance(x, with_wrap))
3025 assert_array_equal(x, np.array((1, 2, 3)))
3026
3027 def test_priority_with_scalar(self):
3028 # test fix for bug #826:

Callers

nothing calls this directly

Calls 3

assert_Function · 0.90
assert_array_equalFunction · 0.90
with_wrapClass · 0.85

Tested by

no test coverage detected