code: def test_virtual_remove(tmp_dir, dvc, remote):
      tmp_dir.gen(
          {
              "dir": {
                  "foo": "foo",
                  "bar": "bar",
                  "subdir": {"lorem": "lorem", "ipsum": "ipsum"},
              }
          }
      )
  
      (stage,) = dvc.add("dir")
      out = stage.outs[0]
  
      assert out.hash_info == HashInfo(
          name="md5", value="15b0e3c73ad2c748ce206988cb6b7319.dir"
      )
      assert out.meta == Meta(isdir=True, size=16, nfiles=4)
  
      assert dvc.push() == 5
      dvc.cache.local.clear()
  
      (tmp_dir / "dir" / "foo").unlink()
      (stage,) = dvc.add("dir/foo")
  
      out = stage.outs[0]
      assert out.hash_info == HashInfo(
          name="md5", value="991ea7d558d320d8817a0798e9c676f1.dir"
      )
      assert out.meta == Meta(isdir=True, size=None, nfiles=3)
  
      assert dvc.push() == 1
  
      shutil.rmtree(tmp_dir / "dir" / "subdir")
      (stage,) = dvc.add("dir/subdir")
  
      out = stage.outs[0]
      assert out.hash_info == HashInfo(
          name="md5", value="91aaa9bb58b657d623ef143b195a67e4.dir"
      )
      assert out.meta == Meta(isdir=True, size=None, nfiles=1)
      assert dvc.push() == 1
  
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 2 for calling a global function with example usage: test_virtual_remove(tmp_dir, dvc, remote) without return types