code: def test_build_overwrite(
      mock_default_data_dir: pathlib.Path,
  ):  # pylint: disable=redefined-outer-name
      data_dir = mock_default_data_dir / "mnist/3.0.1"
      data_dir.mkdir(parents=True)
      metadata_path = tfds.core.tfds_path(
          "testing/test_data/dataset_info/mnist/3.0.1"
      )
  
      for f in metadata_path.iterdir():  # Copy metadata files.
          data_dir.joinpath(f.name).write_text(f.read_text())
  
      # By default, will skip generation if the data already exists
      assert _build("mnist") == ["mnist"]  # Called, but no-op
      assert data_dir.exists()
  
      assert _build("mnist --overwrite") == ["mnist"]
      assert not data_dir.exists()
  
imports: import contextlib
  import os
  import pathlib
  from typing import Dict, Iterator, List, Optional
  from unittest import mock
  from absl.testing import parameterized
  from etils import epath
  import pytest
  import tensorflow_datasets
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import download
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.scripts.cli import build
  from tensorflow_datasets.scripts.cli import main
label_desc: Use image node_id 9 for calling a global function with example usage: test_build_overwrite(mock_default_data_dir) without return types