code: def test_stats_on_checkout(tmp_dir, dvc, scm):
      tmp_dir.dvc_gen(
          {
              "dir": {"subdir": {"file": "file"}, "other": "other"},
              "foo": "foo",
              "bar": "bar",
          },
          commit="initial",
      )
      scm.checkout("HEAD~")
      stats = dvc.checkout()
      assert set(stats["deleted"]) == {"dir" + os.sep, "foo", "bar"}
  
      scm.checkout("-")
      stats = dvc.checkout()
      assert set(stats["added"]) == {"bar", "dir" + os.sep, "foo"}
  
      tmp_dir.gen(
          {"lorem": "lorem", "bar": "new bar", "dir2": {"file": "file"}}
      )
      (tmp_dir / "foo").unlink()
      scm.gitpython.repo.git.rm("foo.dvc")
      tmp_dir.dvc_add(["bar", "lorem", "dir2"], commit="second")
  
      scm.checkout("HEAD~")
      stats = dvc.checkout()
      assert set(stats["modified"]) == {"bar"}
      assert set(stats["added"]) == {"foo"}
      assert set(stats["deleted"]) == {"lorem", "dir2" + os.sep}
  
      scm.checkout("-")
      stats = dvc.checkout()
      assert set(stats["modified"]) == {"bar"}
      assert set(stats["added"]) == {"dir2" + os.sep, "lorem"}
      assert set(stats["deleted"]) == {"foo"}
  
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 21 for calling a global function with example usage: test_stats_on_checkout(tmp_dir, dvc, scm) without return types