| 742 | |
| 743 | |
| 744 | def test_ls_maxdepth(tmp_dir, scm, dvc): |
| 745 | tmp_dir.scm_gen(FS_STRUCTURE, commit="init") |
| 746 | tmp_dir.dvc_gen(DVC_STRUCTURE, commit="dvc") |
| 747 | |
| 748 | files = Repo.ls(os.fspath(tmp_dir), "structure.xml", maxdepth=0, recursive=True) |
| 749 | match_files(files, ((("structure.xml",), True),)) |
| 750 | |
| 751 | files = Repo.ls(os.fspath(tmp_dir), maxdepth=0, recursive=True) |
| 752 | match_files(files, (((os.curdir,), False),)) |
| 753 | |
| 754 | files = Repo.ls(os.fspath(tmp_dir), maxdepth=1, recursive=True) |
| 755 | match_files( |
| 756 | files, |
| 757 | ( |
| 758 | ((".dvcignore",), False), |
| 759 | ((".gitignore",), False), |
| 760 | (("README.md",), False), |
| 761 | (("structure.xml.dvc",), False), |
| 762 | (("model",), False), |
| 763 | (("data",), False), |
| 764 | (("structure.xml",), True), |
| 765 | ), |
| 766 | ) |
| 767 | files = Repo.ls(os.fspath(tmp_dir), maxdepth=2, recursive=True) |
| 768 | match_files( |
| 769 | files, |
| 770 | ( |
| 771 | ((".dvcignore",), False), |
| 772 | ((".gitignore",), False), |
| 773 | (("README.md",), False), |
| 774 | ((join("data", "subcontent"),), False), |
| 775 | ((join("model", ".gitignore"),), False), |
| 776 | ((join("model", "people.csv"),), True), |
| 777 | ((join("model", "people.csv.dvc"),), False), |
| 778 | ((join("model", "script.py"),), False), |
| 779 | ((join("model", "train.py"),), False), |
| 780 | (("structure.xml",), True), |
| 781 | (("structure.xml.dvc",), False), |
| 782 | ), |
| 783 | ) |
| 784 | |
| 785 | files = Repo.ls(os.fspath(tmp_dir), maxdepth=3, recursive=True) |
| 786 | match_files( |
| 787 | files, |
| 788 | ( |
| 789 | ((".dvcignore",), False), |
| 790 | ((".gitignore",), False), |
| 791 | (("README.md",), False), |
| 792 | ((join("data", "subcontent", ".gitignore"),), False), |
| 793 | ((join("data", "subcontent", "data.xml"),), True), |
| 794 | ((join("data", "subcontent", "data.xml.dvc"),), False), |
| 795 | ((join("data", "subcontent", "statistics"),), False), |
| 796 | ((join("model", ".gitignore"),), False), |
| 797 | ((join("model", "people.csv"),), True), |
| 798 | ((join("model", "people.csv.dvc"),), False), |
| 799 | ((join("model", "script.py"),), False), |
| 800 | ((join("model", "train.py"),), False), |
| 801 | ((join("structure.xml"),), True), |