Test it translates from arg to
(self)
| 39 | |
| 40 | class TestTakeAlongAxis: |
| 41 | def test_argequivalent(self): |
| 42 | """ Test it translates from arg<func> to <func> """ |
| 43 | from numpy.random import rand |
| 44 | a = rand(3, 4, 5) |
| 45 | |
| 46 | funcs = [ |
| 47 | (np.sort, np.argsort, {}), |
| 48 | (_add_keepdims(np.min), _add_keepdims(np.argmin), {}), |
| 49 | (_add_keepdims(np.max), _add_keepdims(np.argmax), {}), |
| 50 | #(np.partition, np.argpartition, dict(kth=2)), |
| 51 | ] |
| 52 | |
| 53 | for func, argfunc, kwargs in funcs: |
| 54 | for axis in list(range(a.ndim)) + [None]: |
| 55 | a_func = func(a, axis=axis, **kwargs) |
| 56 | ai_func = argfunc(a, axis=axis, **kwargs) |
| 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 """ |
nothing calls this directly
no test coverage detected