code: def test_average_execution(setup):
      data = arange(1, 5, chunk_size=1)
      t = average(data)
  
      res = t.execute().fetch()
      expected = np.average(np.arange(1, 5))
      assert res == expected
  
      t = average(
          arange(1, 11, chunk_size=2),
          weights=arange(10, 0, -1, chunk_size=2),
      )
  
      res = t.execute().fetch()
      expected = np.average(range(1, 11), weights=range(10, 0, -1))
      assert res == expected
  
      data = arange(6, chunk_size=2).reshape((3, 2))
      t = average(
          data, axis=1, weights=tensor([1.0 / 4, 3.0 / 4], chunk_size=2)
      )
  
      res = t.execute().fetch()
      expected = np.average(
          np.arange(6).reshape(3, 2), axis=1, weights=(1.0 / 4, 3.0 / 4)
      )
      np.testing.assert_equal(res, expected)
  
      with pytest.raises(TypeError):
          average(
              data, weights=tensor([1.0 / 4, 3.0 / 4], chunk_size=2)
          )
  
imports: import numpy
  import scipy.sparse
  import pytest
  from ....utils import ignore_warning
  from ...datasource import arange, tensor, empty
  from ...base import sort
  from ...merge import stack
  from ...reduction import all
  from ..None import average, bincount, cov, corrcoef, ptp, digitize, histogram_bin_edges, histogram, quantile, percentile, median
  from ..quantile import INTERPOLATION_TYPES
label_desc: Use image node_id 1 for calling a global function with example usage: test_average_execution(setup) without return types