Test it errors when indices has too few dimensions
(self)
| 47 | assert_equal(a_func, take_along_axis(a, ai_func, axis=axis)) |
| 48 | |
| 49 | def test_invalid(self): |
| 50 | """ Test it errors when indices has too few dimensions """ |
| 51 | a = np.ones((10, 10)) |
| 52 | ai = np.ones((10, 2), dtype=np.intp) |
| 53 | |
| 54 | # sanity check |
| 55 | take_along_axis(a, ai, axis=1) |
| 56 | |
| 57 | # not enough indices |
| 58 | assert_raises(ValueError, take_along_axis, a, np.array(1), axis=1) |
| 59 | # bool arrays not allowed |
| 60 | assert_raises(IndexError, take_along_axis, a, ai.astype(bool), axis=1) |
| 61 | # float arrays not allowed |
| 62 | assert_raises(IndexError, take_along_axis, a, ai.astype(float), axis=1) |
| 63 | # invalid axis |
| 64 | assert_raises(np.AxisError, take_along_axis, a, ai, axis=10) |
| 65 | |
| 66 | def test_empty(self): |
| 67 | """ Test everything is ok with empty results, even with inserted dims """ |
nothing calls this directly
no test coverage detected