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

Method test_basic

numpy/lib/tests/test_function_base.py:644–662  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

642class TestCumsum:
643
644 def test_basic(self):
645 ba = [1, 2, 10, 11, 6, 5, 4]
646 ba2 = [[1, 2, 3, 4], [5, 6, 7, 9], [10, 3, 4, 5]]
647 for ctype in [np.int8, np.uint8, np.int16, np.uint16, np.int32,
648 np.uint32, np.float32, np.float64, np.complex64,
649 np.complex128]:
650 a = np.array(ba, ctype)
651 a2 = np.array(ba2, ctype)
652
653 tgt = np.array([1, 3, 13, 24, 30, 35, 39], ctype)
654 assert_array_equal(np.cumsum(a, axis=0), tgt)
655
656 tgt = np.array(
657 [[1, 2, 3, 4], [6, 8, 10, 13], [16, 11, 14, 18]], ctype)
658 assert_array_equal(np.cumsum(a2, axis=0), tgt)
659
660 tgt = np.array(
661 [[1, 3, 6, 10], [5, 11, 18, 27], [10, 13, 17, 22]], ctype)
662 assert_array_equal(np.cumsum(a2, axis=1), tgt)
663
664
665class TestProd:

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
cumsumMethod · 0.80

Tested by

no test coverage detected