Test it errors when indices has too few dimensions
(self)
| 57 | assert_equal(a_func, take_along_axis(a, ai_func, axis=axis)) |
| 58 | |
| 59 | def test_invalid(self): |
| 60 | """ Test it errors when indices has too few dimensions """ |
| 61 | a = np.ones((10, 10)) |
| 62 | ai = np.ones((10, 2), dtype=np.intp) |
| 63 | |
| 64 | # sanity check |
| 65 | take_along_axis(a, ai, axis=1) |
| 66 | |
| 67 | # not enough indices |
| 68 | assert_raises(ValueError, take_along_axis, a, np.array(1), axis=1) |
| 69 | # bool arrays not allowed |
| 70 | assert_raises(IndexError, take_along_axis, a, ai.astype(bool), axis=1) |
| 71 | # float arrays not allowed |
| 72 | assert_raises(IndexError, take_along_axis, a, ai.astype(float), axis=1) |
| 73 | # invalid axis |
| 74 | assert_raises(AxisError, take_along_axis, a, ai, axis=10) |
| 75 | # invalid indices |
| 76 | assert_raises(ValueError, take_along_axis, a, ai, axis=None) |
| 77 | |
| 78 | def test_empty(self): |
| 79 | """ Test everything is ok with empty results, even with inserted dims """ |
nothing calls this directly
no test coverage detected