code: def test_complex(ufunc):
      dafunc = getattr(da, ufunc)
      # Note that these functions are not NumPy ufuncs
      npfunc = getattr(np, ufunc)
  
      real = np.random.randint(1, 100, size=(20, 20))
      imag = np.random.randint(1, 100, size=(20, 20)) * 1j
      comp = real + imag
  
      dareal = da.from_array(real, 3)
      daimag = da.from_array(imag, 3)
      dacomp = da.from_array(comp, 3)
  
      assert_eq(dacomp.real, comp.real)
      assert_eq(dacomp.imag, comp.imag)
      assert_eq(dacomp.conj(), comp.conj())
  
      for darr, arr in [(dacomp, comp), (dareal, real), (daimag, imag)]:
          # applying Dask ufunc doesn't trigger computation
          assert isinstance(dafunc(darr), da.Array)
          assert_eq(dafunc(darr), npfunc(arr))
          assert_eq(npfunc(darr), npfunc(arr))
  
          # applying Dask ufunc to normal ndarray triggers computation
          assert isinstance(dafunc(arr), np.ndarray)
          assert_eq(dafunc(arr), npfunc(arr))
  
imports: from __future__ import annotations
  import pickle
  import warnings
  from functools import partial
  from operator import add
  import pytest
  import dask.array
  from dask.array.ufunc import da_frompyfunc
  from dask.array.utils import assert_eq
  from dask.base import tokenize
label_desc: Use image node_id 6 for calling a global function with example usage: test_complex(ufunc) without return types