code: def test_checkout_dir_compat(tmp_dir, dvc):
      (stage,) = tmp_dir.dvc_gen({"data": {"foo": "foo"}})
      tmp_dir.gen(
          "data.dvc",
          textwrap.dedent(
              f"""\
          outs:
          - md5: {stage.outs[0].hash_info.value}
            hash: md5
            path: data
          """
          ),
      )
      remove("data")
      dvc.checkout()
      assert (tmp_dir / "data").read_text() == {"foo": "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 39 for calling a global function with example usage: test_checkout_dir_compat(tmp_dir, dvc) without return types