def test_full_cumsum(): a = np.array(rand(50) * 50, dtype=np.int32) c = full_cumsum(a) assert len(c) == len(a) + 1 for i in range(len(c)): assert c[i] == sum(a[:i])
def test_full_cumsum_multidim(): a = np.array(rand(50, 50, 50) * 50, dtype=np.int32) c = full_cumsum(a, axis=1) assert c.shape[0] == a.shape[0] assert c.shape[1] == a.shape[1] + 1 assert c.shape[2] == a.shape[2] for i in range(a.shape[1]): assert np.all(c[:,i,:] == np.sum(a[:,:i,:], 1))