code: def test_cache(tmp_dir, dvc):
      cache1_md5 = "123"
      cache2_md5 = "234"
      cache1 = os.path.join(
          dvc.cache.local.path,
          cache1_md5[0:2],
          cache1_md5[2:],
      )
      cache2 = os.path.join(
          dvc.cache.local.path,
          cache2_md5[0:2],
          cache2_md5[2:],
      )
      tmp_dir.gen({cache1: "1", cache2: "2"})
  
      assert os.path.exists(cache1)
      assert os.path.exists(cache2)
  
      odb = CacheManager(dvc)
  
      md5_list = list(odb.local.all())
      assert len(md5_list) == 2
      assert cache1_md5 in md5_list
      assert cache2_md5 in md5_list
  
      odb_cache1 = odb.local.oid_to_path(cache1_md5)
      odb_cache2 = odb.local.oid_to_path(cache2_md5)
      assert os.fspath(odb_cache1) == cache1
      assert os.fspath(odb_cache2) == cache2
  
file_path: dvc/tests/func/test_odb.py
imports: import os
  import stat
  import configobj
  import pytest
  from dvc.cachemgr import CacheManager
  from dvc.cli import main
  from dvc.utils import relpath
  from dvc_data.hashfile.hash_info import HashInfo
  from dvc_objects.errors import ObjectFormatError
label_desc: Use image node_id 1 for calling a global function with example usage: test_cache(tmp_dir, dvc) without return types