code: def generate_test(*, link_type="copy"):
      def _test_checkout_func(bench_dvc, tmp_dir, dvc, make_dataset):
          dataset = make_dataset(dvcfile=True, cache=True, files=False)
  
          _skip_unsupported_link(
              (tmp_dir / ".dvc" / "cache"), tmp_dir, link_type
          )
  
          with dvc.config.edit() as conf:
              conf["cache"]["type"] = link_type
  
          bench_dvc("checkout", dataset)
          bench_dvc("checkout", name="noop")
          (dataset / "new").write_text("new")
          bench_dvc("checkout", "--force", name="update")
  
      return _test_checkout_func
  
imports: import os
  import pytest
  from dvc.fs import localfs
  from dvc_objects.fs import generic
  from dvc_objects.fs.utils import tmp_fname
label_desc: Use image node_id 2 for calling a global function with example usage: generate_test() and returns: _test_checkout_func