| 1090 | |
| 1091 | @pytest.mark.parametrize("arg", ["array", "scalar", "subclass"]) |
| 1092 | def test_output_ellipsis(self, arg): |
| 1093 | class subclass(np.ndarray): |
| 1094 | def __array_wrap__(self, obj, context=None, return_value=None): |
| 1095 | return super().__array_wrap__(obj, context, return_value) |
| 1096 | |
| 1097 | if arg == "scalar": |
| 1098 | one = 1 |
| 1099 | expected_type = np.ndarray |
| 1100 | elif arg == "array": |
| 1101 | one = np.array(1) |
| 1102 | expected_type = np.ndarray |
| 1103 | elif arg == "subclass": |
| 1104 | one = np.array(1).view(subclass) |
| 1105 | expected_type = subclass |
| 1106 | |
| 1107 | assert type(np.add(one, 2, out=...)) is expected_type |
| 1108 | assert type(np.add.reduce(one, out=...)) is expected_type |
| 1109 | res1, res2 = np.divmod(one, 2, out=...) |
| 1110 | assert type(res1) is type(res2) is expected_type |
| 1111 | |
| 1112 | def test_output_ellipsis_errors(self): |
| 1113 | with pytest.raises(TypeError, |