code: def test_bulk_sampler_io(scratch_dir):
      results = cudf.DataFrame(
          {
              "sources": [0, 0, 1, 2, 2, 2, 3, 4, 5, 5, 6, 7],
              "destinations": [1, 2, 3, 3, 3, 4, 1, 1, 6, 7, 2, 3],
              "edge_id": None,
              "edge_type": None,
              "weight": None,
              "hop_id": [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],
          }
      )
  
      assert len(results) == 12
  
      offsets = cudf.DataFrame(
          {"offsets": [0, 8, 12], "batch_id": [0, 1, None]}
      )
  
      samples_path = os.path.join(scratch_dir, "test_bulk_sampler_io")
      create_directory_with_overwrite(samples_path)
  
      write_samples(results, offsets, None, 1, samples_path)
  
      assert len(os.listdir(samples_path)) == 2
  
      df = cudf.read_parquet(
          os.path.join(samples_path, "batch=0-0.parquet")
      )
      assert len(df) == 8
  
      assert (
          df.sources.values_host.tolist()
          == results.sources.iloc[0:8].values_host.tolist()
      )
      assert (
          df.destinations.values_host.tolist()
          == results.destinations.iloc[0:8].values_host.tolist()
      )
      assert (
          df.hop_id.values_host.tolist()
          == results.hop_id.iloc[0:8].values_host.tolist()
      )
      assert (df.batch_id == 0).all()
  
      df = cudf.read_parquet(
          os.path.join(samples_path, "batch=1-1.parquet")
      )
      assert len(df) == 4
      assert (
          df.sources.values_host.tolist()
          == results.sources.iloc[8:12].values_host.tolist()
      )
      assert (
          df.destinations.values_host.tolist()
          == results.destinations.iloc[8:12].values_host.tolist()
      )
      assert (
          df.hop_id.values_host.tolist()
          == results.hop_id.iloc[8:12].values_host.tolist()
      )
      assert (df.batch_id == 1).all()
  
      shutil.rmtree(samples_path)
  
file_path: cugraph/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py
imports: import os
  import shutil
  import pytest
  import cupy
  import cudf
  from cugraph.gnn.data_loading.bulk_sampler_io import write_samples
  from cugraph.utilities.utils import create_directory_with_overwrite
label_desc: Use image node_id 1 for calling a global function with example usage: test_bulk_sampler_io(scratch_dir) without return types