def test_isdir_mixed(tmp_dir, dvc): tmp_dir.gen({"dir": {"foo": "foo", "bar": "bar"}}) dvc.add(str(tmp_dir / "dir" / "foo")) tree = RepoTree(dvc) assert tree.isdir("dir") assert not tree.isfile("dir")
def test_isdir_isfile(tmp_dir, dvc): tmp_dir.gen({"datafile": "data", "datadir": {"foo": "foo", "bar": "bar"}}) tree = RepoTree(dvc) assert tree.isdir("datadir") assert not tree.isfile("datadir") assert not tree.isdvc("datadir") assert not tree.isdir("datafile") assert tree.isfile("datafile") assert not tree.isdvc("datafile") dvc.add(["datadir", "datafile"]) shutil.rmtree(tmp_dir / "datadir") (tmp_dir / "datafile").unlink() assert tree.isdir("datadir") assert not tree.isfile("datadir") assert tree.isdvc("datadir") assert not tree.isdir("datafile") assert tree.isfile("datafile") assert tree.isdvc("datafile")