(self)
| 150 | [[27, 30, 33], [36, 39, 42], [45, 48, 51]]) |
| 151 | |
| 152 | def test_preserve_subclass(self): |
| 153 | def double(row): |
| 154 | return row * 2 |
| 155 | |
| 156 | class MyNDArray(np.ndarray): |
| 157 | pass |
| 158 | |
| 159 | m = np.array([[0, 1], [2, 3]]).view(MyNDArray) |
| 160 | expected = np.array([[0, 2], [4, 6]]).view(MyNDArray) |
| 161 | |
| 162 | result = apply_along_axis(double, 0, m) |
| 163 | assert_(isinstance(result, MyNDArray)) |
| 164 | assert_array_equal(result, expected) |
| 165 | |
| 166 | result = apply_along_axis(double, 1, m) |
| 167 | assert_(isinstance(result, MyNDArray)) |
| 168 | assert_array_equal(result, expected) |
| 169 | |
| 170 | def test_subclass(self): |
| 171 | class MinimalSubclass(np.ndarray): |
nothing calls this directly
no test coverage detected