code: def test_diag_2d_array_creation(k):
      # when input 1d-array is a numpy array:
      v = np.arange(11)
      assert_eq(da.diag(v, k), np.diag(v, k))
  
      # when input 1d-array is a dask array:
      v = da.arange(11, chunks=3)
      darr = da.diag(v, k)
      nparr = np.diag(v, k)
      assert_eq(darr, nparr)
      assert sorted(da.diag(v, k).dask) == sorted(da.diag(v, k).dask)
  
      v = v + v + 3
      darr = da.diag(v, k)
      nparr = np.diag(v, k)
      assert_eq(darr, nparr)
  
      v = da.arange(11, chunks=11)
      darr = da.diag(v, k)
      nparr = np.diag(v, k)
      assert_eq(darr, nparr)
      assert sorted(da.diag(v, k).dask) == sorted(da.diag(v, k).dask)
  
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 17 for calling a global function with example usage: test_diag_2d_array_creation(k) without return types