code: def test_to_backend_cupy():
      # Test that `Array.to_backend` works as expected
      with config.set({"array.backend": "numpy"}):
          # Start with cupy-backed array
          x = da.from_array(cupy.arange(11), chunks=(4,))
          assert isinstance(x._meta, cupy.ndarray)
  
          # Calling default `to_backend` should move
          # backend to `numpy`
          x_new = x.to_backend()
          assert isinstance(x_new._meta, np.ndarray)
  
          # Calling `to_backend("cudf")` should always
          # move the data back to `cupy`
          x_new = x.to_backend("cupy")
          assert isinstance(x_new._meta, cupy.ndarray)
  
          # Change global "array.backend" config to `cupy`
          with config.set({"array.backend": "cupy"}):
              # Calling `to_backend("numpy")` should
              # always move the data to `numpy`
              x_new = x.to_backend("numpy")
              assert isinstance(x_new._meta, np.ndarray)
  
              # Calling default `to_backend()` should
              # satisfy the global config (now `cupy`)
              x_new = x.to_backend()
              assert isinstance(x_new._meta, cupy.ndarray)
  
      assert_eq(x, x.to_backend("numpy"), check_type=False)
      assert_eq(x, x.to_backend("cupy"))
  
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 5 for calling a global function with example usage: test_to_backend_cupy() without return types