code: def test_dir(
      self, tmp_dir, dvc, run_copy, remote_version_aware
  ):  # noqa: PLR0915
      (stage,) = tmp_dir.dvc_gen(
          {
              "data_dir": {
                  "data_sub_dir": {"data_sub": "data_sub"},
                  "data": "data",
                  "empty": "",
              }
          }
      )
  
      assert not dvc.fetch()
      assert dvc.push()
  
      data_dir_dvc = (tmp_dir / "data_dir.dvc").read_text()
      assert "files" in data_dir_dvc
      assert "version_id" in data_dir_dvc
      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")
  
      assert 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"
      assert (tmp_dir / "data_dir.dvc").read_text() == data_dir_dvc
  
      run_copy("data_dir", "data_dir_copy", name="copy")
      dvc_lock = (tmp_dir / "dvc.lock").read_text()
  
      assert dvc.push()
      assert (remote_version_aware / "data_dir").exists()
      assert (remote_version_aware / "data_dir" / "data").exists()
      assert (remote_version_aware / "data_dir_copy").exists()
      assert (remote_version_aware / "data_dir_copy" / "data").exists()
      assert (tmp_dir / "data_dir.dvc").read_text() == data_dir_dvc
      assert (tmp_dir / "dvc.lock").read_text() != dvc_lock
      dvc_lock = (tmp_dir / "dvc.lock").read_text()
  
      assert not dvc.push()
      assert (remote_version_aware / "data_dir").exists()
      assert (remote_version_aware / "data_dir" / "data").exists()
      assert (remote_version_aware / "data_dir_copy").exists()
      assert (remote_version_aware / "data_dir_copy" / "data").exists()
      assert (tmp_dir / "data_dir.dvc").read_text() == data_dir_dvc
      assert (tmp_dir / "dvc.lock").read_text() == dvc_lock
  
      dvc.cache.local.clear()
      remove(tmp_dir / "data_dir")
      remove(tmp_dir / "data_dir_copy")
      assert not dvc.push()
      assert (remote_version_aware / "data_dir").exists()
      assert (remote_version_aware / "data_dir" / "data").exists()
      assert (remote_version_aware / "data_dir_copy").exists()
      assert (remote_version_aware / "data_dir_copy" / "data").exists()
      assert (tmp_dir / "data_dir.dvc").read_text() == data_dir_dvc
      assert (tmp_dir / "dvc.lock").read_text() == dvc_lock
  
      (remote_version_aware / "data_dir").rmdir()
      (remote_version_aware / "data_dir_copy").rmdir()
      assert not (remote_version_aware / "data_dir").exists()
      assert not (remote_version_aware / "data_dir_copy").exists()
      assert 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"
      assert (tmp_dir / "data_dir_copy" / "data").read_text() == "data"
      assert (
          tmp_dir / "data_dir_copy" / "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 TestRemoteVersionAware obj's underlying member method code with example usage: obj.test_dir(tmp_dir, dvc, run_copy, remote_version_aware) without return types