code: def test_virtual_update_file(tmp_dir, dvc, remote):
      tmp_dir.gen({"dir": {"foo": "foo", "subdir": {"lorem": "lorem"}}})
      (stage,) = dvc.add("dir")
      out = stage.outs[0]
  
      assert out.hash_info == HashInfo(
          name="md5", value="22a16c9bf84b3068bc2206d88a6b5776.dir"
      )
      assert out.meta == Meta(isdir=True, size=8, nfiles=2)
  
      assert dvc.push() == 3
      dvc.cache.local.clear()
      shutil.rmtree("dir")
  
      tmp_dir.gen({"dir": {"foo": "foobar"}})
      (stage,) = dvc.add("dir/foo")
      out = stage.outs[0]
      assert out.hash_info == HashInfo(
          name="md5", value="49408ac059c76086a3a892129a324b60.dir"
      )
      assert out.meta == Meta(isdir=True, size=None, nfiles=2)
      assert dvc.push() == 2
  
file_path: dvc/tests/func/test_virtual_directory.py
imports: import shutil
  from os.path import join
  from dvc_data.hashfile.hash_info import HashInfo
  from dvc_data.hashfile.meta import Meta
label_desc: Use image node_id 4 for calling a global function with example usage: test_virtual_update_file(tmp_dir, dvc, remote) without return types