code: def test_get_hash_cached_granular(tmp_dir, dvc, mocker):
      tmp_dir.dvc_gen(
          {
              "dir": {
                  "foo": "foo",
                  "bar": "bar",
                  "subdir": {"data": "data"},
              }
          }
      )
      fs = DVCFileSystem(repo=dvc)
      subdir = "dir/subdir"
      assert fs.info(subdir).get("md5") is None
      _, _, obj = build(dvc.cache.local, subdir, fs, "md5")
      assert obj.hash_info == HashInfo(
          "md5", "af314506f1622d107e0ed3f14ec1a3b5.dir"
      )
      assert fs.info(posixpath.join(subdir, "data")).get("md5") is None
      _, _, obj = build(
          dvc.cache.local, posixpath.join(subdir, "data"), fs, "md5"
      )
      assert obj.hash_info == HashInfo(
          "md5", "8d777f385d3dfec8815d20f7496026dc"
      )
      (tmp_dir / "dir" / "subdir" / "data").unlink()
      assert (
          fs.info(posixpath.join(subdir, "data"))["md5"]
          == "8d777f385d3dfec8815d20f7496026dc"
      )
  
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 24 for calling a global function with example usage: test_get_hash_cached_granular(tmp_dir, dvc, mocker) without return types