code: def test_output(input_type, output_type, dtype, output_format):
      rand_func = (
          cupyx.scipy.sparse if input_type == "cupy" else scipy_sparse
      )
  
      X = rand_func.random(
          100, 100, format="csr", density=0.5, dtype=dtype
      )
  
      X_m = SparseCumlArray(X)
  
      output = X_m.to_output(output_type, output_format=output_format)
  
      if output_type == "scipy":
          if output_format is None:
              assert isinstance(output, scipy_sparse.csr_matrix)
          elif output_format == "coo":
              assert isinstance(output, scipy_sparse.coo_matrix)
          elif output_format == "csc":
              assert isinstance(output, scipy_sparse.csc_matrix)
          else:
              pytest.fail("unecpected output format")
      else:
          if output_format is None:
              assert isinstance(output, cupyx.scipy.sparse.csr_matrix)
          elif output_format == "coo":
              assert isinstance(output, cupyx.scipy.sparse.coo_matrix)
          elif output_format == "csc":
              assert isinstance(output, cupyx.scipy.sparse.csc_matrix)
          else:
              pytest.fail("unecpected output format")
  
      cp.testing.assert_array_equal(X.todense(), output.todense())
  
file_path: cuml/python/cuml/tests/test_array_sparse.py
imports: from cuml.internals.safe_imports import gpu_only_import
  import pytest
  from cuml.internals.array import CumlArray
  from cuml.internals.array_sparse import SparseCumlArray
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 5 for calling a global function with example usage: test_output(input_type, output_type, dtype, output_format) without return types