code: def test_copy_and_overwrite_cli(tmpdir, synthetic_dataset):
      target_url = "file:///" + os.path.join(
          tmpdir.strpath, "copied_data"
      )
      _main([synthetic_dataset.url, target_url])
  
      with make_reader(target_url, num_epochs=1) as reader:
          for row in reader:
              actual = row._asdict()
              expected = next(
                  d
                  for d in synthetic_dataset.data
                  if d["id"] == actual["id"]
              )
              np.testing.assert_equal(actual, expected)
  
      with pytest.raises(AnalysisException, match="already exists"):
          _main([synthetic_dataset.url, target_url])
  
      _main([synthetic_dataset.url, target_url, "--overwrite"])
  
file_path: petastorm/petastorm/tests/test_copy_dataset.py
imports: import glob
  import os
  import numpy
  import pytest
  from pyspark.sql import SparkSession
  from pyspark.sql.utils import AnalysisException
  from petastorm.reader import make_reader
  from petastorm.tools.copy_dataset import _main, copy_dataset
label_desc: Use image node_id 2 for calling a global function with example usage: test_copy_and_overwrite_cli(tmpdir, synthetic_dataset) without return types