code: def test_basic_array(sparse_output, method, categories):
      a = sklearn.preprocessing.OneHotEncoder(
          categories=categories, sparse_output=sparse_output
      )
      b = dask_ml.preprocessing.OneHotEncoder(
          categories=categories, sparse_output=sparse_output
      )
  
      if method == "fit":
          a.fit(X)
          b.fit(dX)
          expected = a.transform(X)
          result = b.transform(dX)
      else:
          expected = a.fit_transform(X)
          result = b.fit_transform(dX)
  
      assert_estimator_equal(
          a,
          b,
          exclude={
              "n_values_",
              "feature_indices_",
              "active_features_",
              "dtypes_",
              "drop_idx_",
              "infrequent_categories_",
          },
      )
  
      assert isinstance(result, da.Array)
  
      # can't use assert_eq since we're apparently making bad graphs
      # See TODO in `transform`.
      assert result.shape == expected.shape
      assert result.dtype == expected.dtype
  
      if sparse_output:
          assert scipy.sparse.issparse(result.blocks[0].compute())
          result = result.compute()
          np.testing.assert_array_almost_equal(
              result.toarray(), expected.toarray()
          )
      else:
          result = result.compute()
          da.utils.assert_eq(result, expected)
  
imports: import dask.array
  import dask.dataframe
  import numpy
  import packaging.version
  import pandas
  import pytest
  import scipy.sparse
  import sklearn.preprocessing
  import dask_ml.preprocessing
  from dask_ml._compat import DASK_2_20_0, PANDAS_VERSION
  from dask_ml.utils import assert_estimator_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_basic_array(sparse_output, method, categories) without return types