code: def test_OnDiskDataset_preprocess_path():
      """Test if the preprocess function can catch the path error."""
      with tempfile.TemporaryDirectory() as test_dir:
          # All metadata fields are specified.
          dataset_name = "graphbolt_test"
  
          yaml_content = f"""
              dataset_name: {dataset_name}
          """
          yaml_file = os.path.join(test_dir, "metadata.yaml")
          with open(yaml_file, "w") as f:
              f.write(yaml_content)
  
          # Case1. Test the passed in is the yaml file path.
          with pytest.raises(
              RuntimeError,
              match="The dataset must be a directory. "
              rf"But got {re.escape(yaml_file)}",
          ):
              _ = gb.OnDiskDataset(yaml_file)
  
          # Case2. Test the passed in is a fake directory.
          fake_dir = os.path.join(test_dir, "fake_dir")
          with pytest.raises(
              RuntimeError,
              match=rf"Invalid dataset path: {re.escape(fake_dir)}",
          ):
              _ = gb.OnDiskDataset(fake_dir)
  
          # Case3. Test the passed in is the dataset directory.
          # But the metadata.yaml is not in the directory.
          os.makedirs(os.path.join(test_dir, "fake_dir"), exist_ok=True)
          with pytest.raises(
              RuntimeError,
              match=r"metadata.yaml does not exist.",
          ):
              _ = gb.OnDiskDataset(fake_dir)
  
imports: import os
  import pickle
  import random
  import re
  import tempfile
  import unittest
  import warnings
  import numpy
  import pandas
  import pydantic
  import pytest
  import torch
  import yaml
  from dgl import graphbolt
  from dgl.base import DGLWarning
  from ..None import gb_test_utils
label_desc: Use image node_id 20 for calling a global function with example usage: test_OnDiskDataset_preprocess_path() without return types