code: def test_checkout_moved_cache_dir_with_symlinks(tmp_dir, dvc):
      tmp_dir.gen({"foo": "foo", "data": {"file": "file"}})
      ret = main(["config", "cache.type", "symlink"])
      assert ret == 0
  
      ret = main(["add", "foo"])
      assert ret == 0
  
      ret = main(["add", "data"])
      assert ret == 0
  
      assert system.is_symlink("foo")
      old_foo_link = os.path.realpath("foo")
  
      assert system.is_symlink(os.path.join("data", "file"))
      old_data_link = os.path.realpath(os.path.join("data", "file"))
  
      old_cache_dir = str(tmp_dir / ".dvc" / "cache")
      new_cache_dir = str(tmp_dir / ".dvc" / "cache_new")
      os.rename(old_cache_dir, new_cache_dir)
  
      ret = main(["cache", "dir", new_cache_dir])
      assert ret == 0
  
      ret = main(["checkout", "-f"])
      assert ret == 0
  
      assert system.is_symlink("foo")
      new_foo_link = os.path.realpath("foo")
  
      assert system.is_symlink(os.path.join("data", "file"))
      new_data_link = os.path.realpath(os.path.join("data", "file"))
  
      assert relpath(old_foo_link, old_cache_dir) == relpath(
          new_foo_link, new_cache_dir
      )
  
      assert relpath(old_data_link, old_cache_dir) == relpath(
          new_data_link, new_cache_dir
      )
  
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 16 for calling a global function with example usage: test_checkout_moved_cache_dir_with_symlinks(tmp_dir, dvc) without return types