code: def test_state(tmp_dir, dvc):
      tmp_dir.gen("foo", "foo content")
      path = tmp_dir / "foo"
      hash_info = HashInfo("md5", file_md5(path, dvc.fs))
  
      state = State(dvc.root_dir, dvc.tmp_dir, dvc.dvcignore)
  
      state.save(str(path), dvc.fs, hash_info)
      assert state.get(str(path), dvc.fs)[1] == hash_info
  
      path.unlink()
      path.write_text("1")
  
      assert state.get(str(path), dvc.fs) == (None, None)
  
      hash_info = HashInfo("md5", file_md5(path, dvc.fs))
      state.save(str(path), dvc.fs, hash_info)
  
      assert state.get(str(path), dvc.fs)[1] == hash_info
  
file_path: dvc/tests/func/test_state.py
imports: import os
  from dvc_data.hashfile.hash import file_md5
  from dvc_data.hashfile.hash_info import HashInfo
  from dvc_data.hashfile.state import State
label_desc: Use image node_id 1 for calling a global function with example usage: test_state(tmp_dir, dvc) without return types