code: def test_diag():
      v = cupy.arange(11)
      dv = da.from_array(v, chunks=(4,), asarray=False)
      assert type(dv._meta) == cupy.ndarray
      assert_eq(
          dv, dv
      )  # Check that _meta and computed arrays match types
      assert_eq(da.diag(dv), cupy.diag(v))
  
      v = v + v + 3
      dv = dv + dv + 3
      darr = da.diag(dv)
      cupyarr = cupy.diag(v)
      assert type(darr._meta) == cupy.ndarray
      assert_eq(
          darr, darr
      )  # Check that _meta and computed arrays match types
      assert_eq(darr, cupyarr)
  
      x = cupy.arange(64).reshape((8, 8))
      dx = da.from_array(x, chunks=(4, 4), asarray=False)
      assert type(dx._meta) == cupy.ndarray
      assert_eq(
          dx, dx
      )  # Check that _meta and computed arrays match types
      assert_eq(da.diag(dx), cupy.diag(x))
  
file_path: dask/dask/array/tests/test_cupy_creation.py
imports: from __future__ import annotations
  import numpy
  import pytest
  import dask.array
  from dask import config
  from dask.array.numpy_compat import AxisError
  from dask.array.utils import assert_eq
label_desc: Use image node_id 1 for calling a global function with example usage: test_diag() without return types