code: def test_root_from_dir_to_file(M, tmp_dir, dvc, scm):
      tmp_dir.dvc_gen({"data": {"foo": "foo", "bar": "bar"}})
      remove("data")
      tmp_dir.gen("data", "file")
  
      assert dvc.data_status() == {
          **EMPTY_STATUS,
          "committed": {"added": [join("data", "")]},
          "uncommitted": {"modified": ["data"]},
          "git": M.dict(),
      }
      assert dvc.data_status(granular=True) == {
          **EMPTY_STATUS,
          "committed": {
              "added": M.unordered(
                  join("data", ""),
                  join("data", "foo"),
                  join("data", "bar"),
              )
          },
          "uncommitted": {
              "deleted": M.unordered(
                  join("data", "foo"), join("data", "bar")
              ),
              "modified": ["data"],
          },
          "git": M.dict(),
      }
  
imports: from os import fspath
  from os.path import join
  import pytest
  from dvc.repo import Repo
  from dvc.repo.data import _transform_git_paths_to_dvc, posixpath_to_os_path
  from dvc.testing.tmp_dir import make_subrepo
  from dvc.utils.fs import remove
label_desc: Use image node_id 21 for calling a global function with example usage: test_root_from_dir_to_file(M, tmp_dir, dvc, scm) without return types