code: def test_checkout_partial(tmp_dir, dvc):
      tmp_dir.dvc_gen(
          {
              "data": {
                  "foo": "foo",
                  "bar": "bar",
                  "sub_dir": {"baz": "baz"},
              }
          }
      )
  
      data_dir = tmp_dir / "data"
      shutil.rmtree(data_dir)
  
      dvc.checkout(str(data_dir / "foo"))
      assert data_dir.read_text() == {"foo": "foo"}
  
      dvc.checkout(str(data_dir / "sub_dir" / "baz"))
      assert data_dir.read_text() == {
          "foo": "foo",
          "sub_dir": {"baz": "baz"},
      }
  
      dvc.checkout(str(data_dir / "bar"))
      assert data_dir.read_text() == {
          "foo": "foo",
          "bar": "bar",
          "sub_dir": {"baz": "baz"},
      }
  
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 35 for calling a global function with example usage: test_checkout_partial(tmp_dir, dvc) without return types