code: def test_get_hash_granular(tmp_dir, dvc):
      tmp_dir.dvc_gen(
          {
              "dir": {
                  "foo": "foo",
                  "bar": "bar",
                  "subdir": {"data": "data"},
              }
          }
      )
      fs = DataFileSystem(index=dvc.index.data["repo"])
      subdir = "dir/subdir"
      assert fs.info(subdir).get("md5") is None
      _, _, obj = build(
          dvc.cache.local, subdir, fs, "md5", dry_run=True
      )
      assert obj.hash_info == HashInfo(
          "md5", "af314506f1622d107e0ed3f14ec1a3b5.dir"
      )
      data = posixpath.join(subdir, "data")
      assert fs.info(data)["md5"] == "8d777f385d3dfec8815d20f7496026dc"
      _, _, obj = build(dvc.cache.local, data, fs, "md5", dry_run=True)
      assert obj.hash_info == HashInfo(
          "md5", "8d777f385d3dfec8815d20f7496026dc"
      )
  
imports: import posixpath
  import shutil
  import pytest
  import dvc_data
  from dvc.fs import localfs
  from dvc.fs.data import DataFileSystem
  from dvc.utils.fs import remove
  from dvc_data.hashfile.build import build
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 16 for calling a global function with example usage: test_get_hash_granular(tmp_dir, dvc) without return types