MCPcopy Create free account
hub / github.com/numpy/numpy / testkeepdims

Method testkeepdims

numpy/ma/tests/test_core.py:5248–5262  ·  view source on GitHub ↗
(f, a, d)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
__getattribute__Method · 0.45

Tested by

no test coverage detected