code: def test_sparse_shuffle():
      """Test that sparse datasets can be shuffled quickly."""
      current_dir = os.path.dirname(os.path.realpath(__file__))
  
      dataset_file = os.path.join(
          current_dir, "../../models/tests/assets/example.csv"
      )
  
      featurizer = dc.feat.CircularFingerprint(size=1024)
      tasks = ["log-solubility"]
      loader = dc.data.CSVLoader(
          tasks=tasks, feature_field="smiles", featurizer=featurizer
      )
      dataset = loader.create_dataset(dataset_file, shard_size=2)
  
      X_orig, y_orig, w_orig, orig_ids = (
          dataset.X,
          dataset.y,
          dataset.w,
          dataset.ids,
      )
      orig_len = len(dataset)
  
      dataset.sparse_shuffle()
      X_new, y_new, w_new, new_ids = (
          dataset.X,
          dataset.y,
          dataset.w,
          dataset.ids,
      )
  
      assert len(dataset) == orig_len
      # The shuffling should have switched up the ordering
      assert not np.array_equal(orig_ids, new_ids)
      # But all the same entries should still be present
      assert sorted(orig_ids) == sorted(new_ids)
      # All the data should have same shape
      assert X_orig.shape == X_new.shape
      assert y_orig.shape == y_new.shape
      assert w_orig.shape == w_new.shape
  
file_path: deepchem/deepchem/data/tests/test_shuffle.py
imports: import os
  import deepchem
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: test_sparse_shuffle() without return types