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

Method test_addsumprod

numpy/ma/tests/test_core.py:1347–1366  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1345 assert masked_array([cmax, 0], mask=[0, 1]).min() == cmax
1346
1347 def test_addsumprod(self):
1348 # Tests add, sum, product.
1349 (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
1350 assert_equal(np.add.reduce(x), add.reduce(x))
1351 assert_equal(np.add.accumulate(x), add.accumulate(x))
1352 assert_equal(4, sum(array(4), axis=0))
1353 assert_equal(4, sum(array(4), axis=0))
1354 assert_equal(np.sum(x, axis=0), sum(x, axis=0))
1355 assert_equal(np.sum(filled(xm, 0), axis=0), sum(xm, axis=0))
1356 assert_equal(np.sum(x, 0), sum(x, 0))
1357 assert_equal(np.prod(x, axis=0), product(x, axis=0))
1358 assert_equal(np.prod(x, 0), product(x, 0))
1359 assert_equal(np.prod(filled(xm, 1), axis=0), product(xm, axis=0))
1360 s = (3, 4)
1361 x.shape = y.shape = xm.shape = ym.shape = s
1362 if len(s) > 1:
1363 assert_equal(np.concatenate((x, y), 1), concatenate((xm, ym), 1))
1364 assert_equal(np.add.reduce(x, 1), add.reduce(x, 1))
1365 assert_equal(np.sum(x, 1), sum(x, 1))
1366 assert_equal(np.prod(x, 1), product(x, 1))
1367
1368 def test_binops_d2D(self):
1369 # Test binary operations on 2D data

Callers

nothing calls this directly

Calls 10

assert_equalFunction · 0.90
sumFunction · 0.90
arrayFunction · 0.90
filledFunction · 0.90
productFunction · 0.90
concatenateFunction · 0.90
accumulateMethod · 0.80
reduceMethod · 0.45
sumMethod · 0.45
prodMethod · 0.45

Tested by

no test coverage detected