code: def test_pad(shape, chunks, pad_width, mode, kwargs):
      np_a = np.random.random(shape)
      da_a = da.from_array(np_a, chunks=chunks)
  
      np_r = np.pad(np_a, pad_width, mode, **kwargs)
      da_r = da.pad(da_a, pad_width, mode, **kwargs)
  
      if mode == "empty":
          # empty pads lead to undefined values which may be different
          assert_eq(
              np_r[pad_width:-pad_width], da_r[pad_width:-pad_width]
          )
      else:
          assert_eq(np_r, da_r)
  
imports: from __future__ import annotations
  import pytest
  import numpy
  import pytest
  from tlz import concat
  import dask
  import dask.array
  from dask.array.core import normalize_chunks
  from dask.array.numpy_compat import AxisError
  from dask.array.utils import assert_eq, same_keys
label_desc: Use image node_id 29 for calling a global function with example usage: test_pad(shape, chunks, pad_width, mode, kwargs) without return types