(self)
| 2931 | |
| 2932 | class 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 |
nothing calls this directly
no test coverage detected