code: def test_overlap():
      x = np.arange(64).reshape((8, 8))
      d = da.from_array(x, chunks=(4, 4))
      g = overlap(
          d, depth={0: 2, 1: 1}, boundary={0: 100, 1: "reflect"}
      )
      assert g.chunks == ((8, 8), (6, 6))
      expected = np.array(
          [
              [
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
              ],
              [
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
              ],
              [0, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 7],
              [8, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 15],
              [16, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 23],
              [24, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 31],
              [32, 32, 33, 34, 35, 36, 35, 36, 37, 38, 39, 39],
              [40, 40, 41, 42, 43, 44, 43, 44, 45, 46, 47, 47],
              [16, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 23],
              [24, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 31],
              [32, 32, 33, 34, 35, 36, 35, 36, 37, 38, 39, 39],
              [40, 40, 41, 42, 43, 44, 43, 44, 45, 46, 47, 47],
              [48, 48, 49, 50, 51, 52, 51, 52, 53, 54, 55, 55],
              [56, 56, 57, 58, 59, 60, 59, 60, 61, 62, 63, 63],
              [
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
              ],
              [
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
                  100,
              ],
          ]
      )
      assert_eq(g, expected)
      assert same_keys(
          g,
          overlap(
              d, depth={0: 2, 1: 1}, boundary={0: 100, 1: "reflect"}
          ),
      )
  
      u_depth = np.uint16([2, 1])
      u_depth = {k: v for k, v in enumerate(u_depth)}
      g = overlap(d, depth=u_depth, boundary={0: 100, 1: "reflect"})
      assert g.chunks == ((8, 8), (6, 6))
      assert_eq(g, expected)
      assert same_keys(
          g,
          overlap(
              d, depth={0: 2, 1: 1}, boundary={0: 100, 1: "reflect"}
          ),
      )
  
      g = overlap(d, depth={0: 2, 1: 1}, boundary={0: 100, 1: "none"})
      expected = np.array(
          [
              [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
              [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
              [0, 1, 2, 3, 4, 3, 4, 5, 6, 7],
              [8, 9, 10, 11, 12, 11, 12, 13, 14, 15],
              [16, 17, 18, 19, 20, 19, 20, 21, 22, 23],
              [24, 25, 26, 27, 28, 27, 28, 29, 30, 31],
              [32, 33, 34, 35, 36, 35, 36, 37, 38, 39],
              [40, 41, 42, 43, 44, 43, 44, 45, 46, 47],
              [16, 17, 18, 19, 20, 19, 20, 21, 22, 23],
              [24, 25, 26, 27, 28, 27, 28, 29, 30, 31],
              [32, 33, 34, 35, 36, 35, 36, 37, 38, 39],
              [40, 41, 42, 43, 44, 43, 44, 45, 46, 47],
              [48, 49, 50, 51, 52, 51, 52, 53, 54, 55],
              [56, 57, 58, 59, 60, 59, 60, 61, 62, 63],
              [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
              [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
          ]
      )
      assert_eq(g, expected)
      assert g.chunks == ((8, 8), (5, 5))
  
      u_depth = np.uint16([2, 1])
      u_depth = {k: v for k, v in enumerate(u_depth)}
      g = overlap(d, depth=u_depth, boundary={0: 100, 1: "none"})
      assert_eq(g, expected)
      assert g.chunks == ((8, 8), (5, 5))
  
imports: from __future__ import annotations
  import pytest
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  import dask.array
  from dask.array.lib.stride_tricks import sliding_window_view
  from dask.array.overlap import boundaries, constant, ensure_minimum_chunksize, nearest, overlap, overlap_internal, periodic, reflect, trim_internal
  from dask.array.utils import assert_eq, same_keys
label_desc: Use image node_id 10 for calling a global function with example usage: test_overlap() without return types