code: def test_coarsen():
      x = np.random.randint(10, size=(24, 24))
      y = coarsen(np.sum, x, {0: 2, 1: 4})
      assert y.shape == (12, 6)
      assert y[0, 0] == np.sum(x[:2, :4])
  
file_path: dask/dask/array/tests/test_chunk.py
imports: from __future__ import annotations
  import pytest
  import operator
  import numpy
  import dask.array
  from dask.array.chunk import coarsen, getitem, keepdims_wrapper
label_desc: Use image node_id 4 for calling a global function with example usage: test_coarsen() without return types