(self)
| 93 | |
| 94 | class TestPutAlongAxis: |
| 95 | def test_replace_max(self): |
| 96 | a_base = np.array([[10, 30, 20], [60, 40, 50]]) |
| 97 | |
| 98 | for axis in list(range(a_base.ndim)) + [None]: |
| 99 | # we mutate this in the loop |
| 100 | a = a_base.copy() |
| 101 | |
| 102 | # replace the max with a small value |
| 103 | i_max = _add_keepdims(np.argmax)(a, axis=axis) |
| 104 | put_along_axis(a, i_max, -99, axis=axis) |
| 105 | |
| 106 | # find the new minimum, which should max |
| 107 | i_min = _add_keepdims(np.argmin)(a, axis=axis) |
| 108 | |
| 109 | assert_equal(i_min, i_max) |
| 110 | |
| 111 | def test_broadcast(self): |
| 112 | """ Test that non-indexing dimensions are broadcast in both directions """ |
nothing calls this directly
no test coverage detected