code: def test_check_array():
      # accept_sparse
      arr = coo_matrix((3, 4), dtype=cp.float64)
      check_array(arr, accept_sparse=True)
      with pytest.raises(ValueError):
          check_array(arr, accept_sparse=False)
  
      # dtype
      arr = cp.array([[1, 2]], dtype=cp.int64)
      check_array(arr, dtype=cp.int64, copy=False)
  
      arr = cp.array([[1, 2]], dtype=cp.float32)
      new_arr = check_array(arr, dtype=cp.int64)
      assert new_arr.dtype == cp.int64
  
      # order
      arr = cp.array([[1, 2]], dtype=cp.int64, order="F")
      new_arr = check_array(arr, order="F")
      assert new_arr.flags.f_contiguous
      new_arr = check_array(arr, order="C")
      assert new_arr.flags.c_contiguous
  
      # force_all_finite
      arr = cp.array([[1, cp.inf]])
      check_array(arr, force_all_finite=False)
      with pytest.raises(ValueError):
          check_array(arr, force_all_finite=True)
  
      # ensure_2d
      arr = cp.array([1, 2], dtype=cp.float32)
      check_array(arr, ensure_2d=False)
      with pytest.raises(ValueError):
          check_array(arr, ensure_2d=True)
  
      # ensure_2d
      arr = cp.array([[1, 2, 3], [4, 5, 6]], dtype=cp.float32)
      check_array(arr, ensure_2d=True)
  
      # ensure_min_samples
      arr = cp.array([[1, 2]], dtype=cp.float32)
      check_array(arr, ensure_min_samples=1)
      with pytest.raises(ValueError):
          check_array(arr, ensure_min_samples=2)
  
      # ensure_min_features
      arr = cp.array([[]], dtype=cp.float32)
      check_array(arr, ensure_min_features=0)
      with pytest.raises(ValueError):
          check_array(arr, ensure_min_features=1)
  
imports: import platform
  from sklearn.preprocessing import normalize
  from cuml.testing.test_preproc_utils import assert_allclose
  from cuml.thirdparty_adapters.sparsefuncs_fast import csr_mean_variance_axis0, csc_mean_variance_axis0, _csc_mean_variance_axis0, inplace_csr_row_normalize_l1, inplace_csr_row_normalize_l2
  from sklearn.utils._mask import _get_mask
  from cuml.thirdparty_adapters.adapters import check_array, _get_mask, _masked_column_median, _masked_column_mean, _masked_column_mode
  from cuml.internals.safe_imports import cpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import cpu_only_import
  import pytest
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 3 for calling a global function with example usage: test_check_array() without return types