code: def test_checkout_with_deps(tmp_dir, dvc):
      tmp_dir.dvc_gen({"foo": "foo"})
      dvc.run(
          cmd="echo foo > bar",
          outs=["bar"],
          deps=["foo"],
          name="copy-file",
      )
  
      (tmp_dir / "bar").unlink()
      (tmp_dir / "foo").unlink()
  
      stats = dvc.checkout(["copy-file"], with_deps=False)
      assert stats == {**empty_checkout, "added": ["bar"]}
  
      (tmp_dir / "bar").unlink()
      stats = dvc.checkout(["copy-file"], with_deps=True)
      assert set(stats["added"]) == {"foo", "bar"}
  
imports: import logging
  import os
  import shutil
  import stat
  import textwrap
  import pytest
  from dvc.cli import main
  from dvc.dvcfile import PROJECT_FILE, load_file
  from dvc.exceptions import CheckoutError, CheckoutErrorSuggestGit, NoOutputOrStageError
  from dvc.fs import system
  from dvc.stage.exceptions import StageFileDoesNotExistError
  from dvc.utils import relpath
  from dvc.utils.fs import remove
  from tests.utils import get_gitignore_content
label_desc: Use image node_id 29 for calling a global function with example usage: test_checkout_with_deps(tmp_dir, dvc) without return types