(self)
| 121 | [[27, 30, 33], [36, 39, 42], [45, 48, 51]]) |
| 122 | |
| 123 | def test_preserve_subclass(self): |
| 124 | def double(row): |
| 125 | return row * 2 |
| 126 | |
| 127 | class MyNDArray(np.ndarray): |
| 128 | pass |
| 129 | |
| 130 | m = np.array([[0, 1], [2, 3]]).view(MyNDArray) |
| 131 | expected = np.array([[0, 2], [4, 6]]).view(MyNDArray) |
| 132 | |
| 133 | result = apply_along_axis(double, 0, m) |
| 134 | assert_(isinstance(result, MyNDArray)) |
| 135 | assert_array_equal(result, expected) |
| 136 | |
| 137 | result = apply_along_axis(double, 1, m) |
| 138 | assert_(isinstance(result, MyNDArray)) |
| 139 | assert_array_equal(result, expected) |
| 140 | |
| 141 | def test_subclass(self): |
| 142 | class MinimalSubclass(np.ndarray): |
nothing calls this directly
no test coverage detected