code: def test_slice_mostly_sorted(keep):
      import dask.array as da
      import numpy as np
      from dask.array.utils import assert_eq
  
      from dask_ml.cluster.spectral import _slice_mostly_sorted
  
      X = np.arange(10).reshape(-1, 1)
  
      dX = da.from_array(X, chunks=5)
      keep = np.array(keep).ravel()
      rest = ~np.isin(X, keep).ravel()
  
      array = dX[np.concatenate([X[keep], X[rest]]).ravel()]
      result = _slice_mostly_sorted(array, keep, rest)
  
      assert_eq(result, X)
      assert all(x > 0 for x in result.chunks[0])
  
file_path: dask-ml/tests/test_spectral_clustering.py
imports: from functools import partial
  import numpy
  import pytest
  import sklearn.cluster
  from dask_ml import metrics
  from dask_ml.cluster import SpectralClustering
  from dask_ml.datasets import make_blobs
label_desc: Use image node_id 8 for calling a global function with example usage: test_slice_mostly_sorted(keep) without return types