code: def test_get_hash_cached_dir(tmp_dir, dvc, mocker):
      tmp_dir.dvc_gen(
          {
              "dir": {
                  "foo": "foo",
                  "bar": "bar",
                  "subdir": {"data": "data"},
              }
          }
      )
      fs = DVCFileSystem(repo=dvc)
      expected = "8761c4e9acad696bee718615e23e22db.dir"
      assert fs.info("dir").get("md5") is None
      _, _, obj = build(dvc.cache.local, "dir", fs, "md5")
      assert obj.hash_info == HashInfo(
          "md5", "8761c4e9acad696bee718615e23e22db.dir"
      )
  
      shutil.rmtree(tmp_dir / "dir")
      assert fs.info("dir")["md5"] == expected
      _, _, obj = build(dvc.cache.local, "dir", fs, "md5")
      assert obj.hash_info == HashInfo(
          "md5", "8761c4e9acad696bee718615e23e22db.dir"
      )
  
imports: import os
  import posixpath
  import shutil
  import pytest
  from fsspec.utils import tokenize
  from dvc.fs import localfs
  from dvc.fs.dvc import DVCFileSystem
  from dvc.testing.tmp_dir import make_subrepo
  from dvc_data.hashfile.build import build
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 23 for calling a global function with example usage: test_get_hash_cached_dir(tmp_dir, dvc, mocker) without return types