code: def test_cum_reduction(setup):
      raw = np.random.randint(5, size=(8, 8, 8))
  
      arr = tensor(raw, chunk_size=6)
  
      res1 = arr.cumsum(axis=1).execute().fetch()
      res2 = arr.cumprod(axis=1).execute().fetch()
      expected1 = raw.cumsum(axis=1)
      expected2 = raw.cumprod(axis=1)
      np.testing.assert_array_equal(res1, expected1)
      np.testing.assert_array_equal(res2, expected2)
  
      raw = sps.random(8, 8, density=0.1)
  
      arr = tensor(raw, chunk_size=6)
  
      res1 = arr.cumsum(axis=1).execute().fetch()
      res2 = arr.cumprod(axis=1).execute().fetch()
      expected1 = raw.A.cumsum(axis=1)
      expected2 = raw.A.cumprod(axis=1)
      assert np.allclose(res1, expected1)
      assert np.allclose(res2, expected2)
  
      # test order
      raw = np.asfortranarray(np.random.rand(10, 20, 30))
      arr = tensor(raw, chunk_size=13)
      arr2 = arr.cumsum(axis=-1)
  
      res = arr2.execute().fetch()
      expected = raw.cumsum(axis=-1)
      np.testing.assert_allclose(res, expected)
      assert res.flags["C_CONTIGUOUS"] == expected.flags["C_CONTIGUOUS"]
      assert res.flags["F_CONTIGUOUS"] == expected.flags["F_CONTIGUOUS"]
  
      # test string dtype
      a = tensor(list("abcdefghi"), dtype=object)
      np.testing.assert_array_equal(
          a.cumsum().execute().fetch(),
          np.cumsum(np.array(list("abcdefghi"), dtype=object)),
      )
      a = tensor(list("abcdefghi"), dtype=object, chunk_size=2)
      np.testing.assert_array_equal(
          a.cumsum().execute().fetch(),
          np.cumsum(np.array(list("abcdefghi"), dtype=object)),
      )
  
      # test empty chunks
      raw = np.random.rand(100)
      arr = tensor(raw, chunk_size=((0, 100),))
      res = arr.cumsum().execute().fetch()
      expected = raw.cumsum()
      np.testing.assert_allclose(res, expected)
      res = arr.cumprod().execute().fetch()
      expected = raw.cumprod()
      np.testing.assert_allclose(res, expected)
  
imports: import numpy
  import scipy.sparse
  import pytest
  from ....utils import ignore_warning
  from ...datasource import ones, tensor
  from ..None import mean, nansum, nanmax, nanmin, nanmean, nanprod, nanargmax, nanargmin, nanvar, nanstd, count_nonzero, allclose, array_equal, var, std, nancumsum, nancumprod
label_desc: Use image node_id 9 for calling a global function with example usage: test_cum_reduction(setup) without return types