code: def test_virtual_add(tmp_dir, dvc, remote):
      tmp_dir.gen({"dir": {"foo": "foo", "bar": "bar"}})
  
      (stage,) = dvc.add("dir")
      out = stage.outs[0]
  
      assert out.hash_info == HashInfo(
          name="md5", value="5ea40360f5b4ec688df672a4db9c17d1.dir"
      )
      assert out.meta == Meta(isdir=True, size=6, nfiles=2)
  
      assert dvc.push() == 3
      dvc.cache.local.clear()
  
      tmp_dir.gen(
          {
              "dir": {
                  "foobar": "foobar",
                  "lorem": "ipsum",
                  "subdir": {"file": "file"},
              }
          }
      )
      (stage,) = dvc.add("dir/foobar")
  
      out = stage.outs[0]
      assert out.hash_info == HashInfo(
          name="md5", value="a5beca056acbef9e0013347efdc2b751.dir"
      )
      assert out.meta == Meta(isdir=True, size=12, nfiles=3)
      assert dvc.push() == 2
  
      (stage,) = dvc.add("dir/subdir")
      out = stage.outs[0]
      assert out.hash_info == HashInfo(
          name="md5", value="de78e9fff7c3478c6b316bf08437d0f6.dir"
      )
      assert out.meta == Meta(isdir=True, size=16, nfiles=4)
      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 1 for calling a global function with example usage: test_virtual_add(tmp_dir, dvc, remote) without return types