(f, a, d)
| 5246 | numpy_f(d[...,:-1], axis=(0,1))) |
| 5247 | |
| 5248 | def testkeepdims(f, a, d): |
| 5249 | numpy_f = numpy.__getattribute__(f) |
| 5250 | ma_f = np.ma.__getattribute__(f) |
| 5251 | |
| 5252 | # test keepdims arg |
| 5253 | assert_equal(ma_f(a, keepdims=True).shape, |
| 5254 | numpy_f(d, keepdims=True).shape) |
| 5255 | assert_equal(ma_f(a, keepdims=False).shape, |
| 5256 | numpy_f(d, keepdims=False).shape) |
| 5257 | |
| 5258 | # test both at once |
| 5259 | assert_equal(ma_f(a, axis=1, keepdims=True)[...,:-1], |
| 5260 | numpy_f(d[...,:-1], axis=1, keepdims=True)) |
| 5261 | assert_equal(ma_f(a, axis=(0,1), keepdims=True)[...,:-1], |
| 5262 | numpy_f(d[...,:-1], axis=(0,1), keepdims=True)) |
| 5263 | |
| 5264 | for f in ['sum', 'prod', 'mean', 'var', 'std']: |
| 5265 | testaxis(f, a, d) |
nothing calls this directly
no test coverage detected