code: def test_status_download_optimization(mocker, dvc):
      """When comparing the status to pull a remote cache,
      And the desired files to fetch are already on the local cache,
      Don't check the existence of the desired files on the remote cache
      """
      from dvc_data.hashfile.status import compare_status
  
      odb = LocalHashFileDB(LocalFileSystem(), os.getcwd())
      obj_ids = {
          HashInfo("md5", "acbd18db4cc2f85cedef654fccc4a4d8"),
          HashInfo("md5", "37b51d194a7513e45b56f6524f2d51f2"),
      }
  
      local_exists = [hash_info.value for hash_info in obj_ids]
      mocker.patch.object(odb, "oids_exist", return_value=local_exists)
  
      src_odb = mocker.Mock()
  
      compare_status(src_odb, odb, obj_ids, check_deleted=False)
      assert src_odb.oids_exist.call_count == 0
  
file_path: dvc/tests/unit/data/db/test_local.py
imports: import errno
  import os
  import pytest
  from dvc.fs import LocalFileSystem
  from dvc_data.hashfile.db.local import LocalHashFileDB
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 1 for calling a global function with example usage: test_status_download_optimization(mocker, dvc) without return types