code: def test_get_hash_dirty_file(tmp_dir, dvc):
      from dvc_data.hashfile import check
      from dvc_data.hashfile.hash import hash_file
  
      tmp_dir.dvc_gen("file", "file")
      file_hash_info = HashInfo(
          "md5", "8c7dd922ad47494fc02c388e12c00eac"
      )
  
      (tmp_dir / "file").write_text("something")
      something_hash_info = HashInfo(
          "md5", "437b930db84b8079c2dd804a71936b5f"
      )
  
      # file is modified in workspace
      # hash_file(file) should return workspace hash, not DVC cached hash
      fs = DVCFileSystem(repo=dvc)
      assert fs.info("file").get("md5") is None
      staging, _, obj = build(dvc.cache.local, "file", fs, "md5")
      assert obj.hash_info == something_hash_info
      check(staging, obj)
  
      # hash_file(file) should return DVC cached hash
      (tmp_dir / "file").unlink()
      assert fs.info("file")["md5"] == file_hash_info.value
      _, hash_info = hash_file("file", fs, "md5", state=dvc.state)
      assert hash_info == file_hash_info
  
      # tmp_dir/file can be built even though it is missing in workspace since
      # repofs will use the DVC cached hash (and refer to the local cache object)
      _, _, obj = build(dvc.cache.local, "file", fs, "md5")
      assert obj.hash_info == file_hash_info
  
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 26 for calling a global function with example usage: test_get_hash_dirty_file(tmp_dir, dvc) without return types