code: def test_dir(self, tmp_dir, dvc, remote_worktree):
      (stage,) = tmp_dir.dvc_gen(
          {
              "data_dir": {
                  "data_sub_dir": {"data_sub": "data_sub"},
                  "data": "data",
                  "empty": "",
              }
          }
      )
  
      dvc.push()
      assert "files" in (tmp_dir / "data_dir.dvc").read_text()
      assert "version_id" in (tmp_dir / "data_dir.dvc").read_text()
      stage = stage.reload()
      out = stage.outs[0]
      assert out.files
      for file in out.files:
          assert file["version_id"]
          assert file["remote"] == "upstream"
  
      remove(dvc.cache.local.path)
      remove(tmp_dir / "data_dir")
  
      dvc.pull()
      assert (tmp_dir / "data_dir" / "data").read_text() == "data"
      assert (
          tmp_dir / "data_dir" / "data_sub_dir" / "data_sub"
      ).read_text() == "data_sub"
  
file_path: dvc/dvc/testing/remote_tests.py
imports: import os
  import shutil
  import pytest
  from dvc.stage.cache import RunCacheNotSupported
  from dvc.utils.fs import remove
  from dvc_data.hashfile.tree import Tree
label_desc: Use image node_id 2 for calling the TestRemoteWorktree obj's underlying member method code with example usage: obj.test_dir(tmp_dir, dvc, remote_worktree) without return types