code: def test_copy_array(
      *,
      test_flags,
      dtype_and_x,
      to_ivy_array_bool,
      backend_fw,
      on_device,
  ):
      dtype, x = dtype_and_x
      # avoid enabling gradients for non-float arrays
      if test_flags.as_variable[0]:
          assume("float" in dtype[0])
      # smoke test
      with BackendHandler.update_backend(backend_fw) as ivy_backend:
          x = test_flags.apply_flags(
              x, dtype, 0, backend=backend_fw, on_device=on_device
          )[0]
          test_flags.instance_method = (
              test_flags.instance_method
              if not test_flags.native_arrays[0]
              else False
          )
          if test_flags.instance_method:
              ret = x.copy_array(to_ivy_array=to_ivy_array_bool)
          else:
              ret = ivy_backend.copy_array(
                  x, to_ivy_array=to_ivy_array_bool
              )
          # type test
          test_ret = ret
          test_x = x
          if test_flags.container[0]:
              assert ivy_backend.is_ivy_container(ret)
              test_ret = ret["a"]
              test_x = x["a"]
          if to_ivy_array_bool:
              assert ivy_backend.is_ivy_array(test_ret)
          else:
              assert ivy_backend.is_native_array(test_ret)
          # cardinality test
          assert test_ret.shape == test_x.shape
          # value test
          x, ret = ivy_backend.to_ivy(x), ivy_backend.to_ivy(ret)
          x_np, ret_np = helpers.flatten_and_to_np(
              backend=backend_fw, ret=x
          ), helpers.flatten_and_to_np(backend=backend_fw, ret=ret)
          helpers.value_test(
              backend=backend_fw,
              ground_truth_backend=backend_fw,
              ret_np_flat=ret_np,
              ret_np_from_gt_flat=x_np,
          )
          assert id(x) != id(ret)
  
imports: from hypothesis import strategies, assume
  import numpy
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test, BackendHandler
  import ivy_tests.test_ivy.helpers.globals
  from ivy_tests.test_ivy.test_functional.test_core.test_dtype import astype_helper
label_desc: Use image node_id 10 for calling a global function with example usage: test_copy_array() without return types