code: def test_directories(tmp_dir, scm, dvc):
      tmp_dir.dvc_gen(
          {"dir": {"1": "1", "2": "2"}}, commit="add a directory"
      )
      tmp_dir.dvc_gen({"dir": {"3": "3"}}, commit="add a file")
      tmp_dir.dvc_gen({"dir": {"2": "two"}}, commit="modify a file")
  
      (tmp_dir / "dir" / "2").unlink()
      assert dvc.status() != {}  # sanity check
      dvc.add("dir")
      scm.add(["dir.dvc"])
      scm.commit("delete a file")
  
      # The ":/<text>" format is a way to specify revisions by commit message:
      #       https://git-scm.com/docs/revisions
      #
      assert dvc.diff(":/init", ":/directory") == {
          "added": [
              {
                  "path": os.path.join("dir", ""),
                  "hash": "5fb6b29836c388e093ca0715c872fe2a.dir",
              },
              {"path": os.path.join("dir", "1"), "hash": digest("1")},
              {"path": os.path.join("dir", "2"), "hash": digest("2")},
          ],
          "deleted": [],
          "modified": [],
          "not in cache": [],
          "renamed": [],
      }
  
      assert dvc.diff(":/directory", ":/modify") == {
          "added": [
              {"path": os.path.join("dir", "3"), "hash": digest("3")}
          ],
          "deleted": [],
          "modified": [
              {
                  "path": os.path.join("dir", ""),
                  "hash": {
                      "old": "5fb6b29836c388e093ca0715c872fe2a.dir",
                      "new": "9b5faf37366b3370fd98e3e60ca439c1.dir",
                  },
              },
              {
                  "path": os.path.join("dir", "2"),
                  "hash": {"old": digest("2"), "new": digest("two")},
              },
          ],
          "not in cache": [],
          "renamed": [],
      }
  
      assert dvc.diff(":/modify", ":/delete") == {
          "added": [],
          "deleted": [
              {"path": os.path.join("dir", "2"), "hash": digest("two")}
          ],
          "modified": [
              {
                  "path": os.path.join("dir", ""),
                  "hash": {
                      "old": "9b5faf37366b3370fd98e3e60ca439c1.dir",
                      "new": "83ae82fb367ac9926455870773ff09e6.dir",
                  },
              }
          ],
          "not in cache": [],
          "renamed": [],
      }
  
imports: import hashlib
  import os
  import pytest
  from funcy import first
  from dvc.exceptions import DvcException
  from dvc.utils.fs import remove
label_desc: Use image node_id 11 for calling a global function with example usage: test_directories(tmp_dir, scm, dvc) without return types