MCPcopy
hub / github.com/treeverse/dvc / test_fs_ls_tree_maxdepth

Function test_fs_ls_tree_maxdepth

tests/func/test_ls.py:1034–1063  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1032
1033
1034def test_fs_ls_tree_maxdepth():
1035 fs = MemoryFileSystem(global_store=False)
1036 fs.pipe({f: content.encode() for f, content in FS_STRUCTURE.items()})
1037
1038 files = _ls_tree(fs, "/", maxdepth=0)
1039 assert _simplify_tree(files) == {"/": None}
1040
1041 files = _ls_tree(fs, "/", maxdepth=1)
1042 assert _simplify_tree(files) == {
1043 "/": {
1044 ".gitignore": None,
1045 "README.md": None,
1046 "model": None,
1047 }
1048 }
1049
1050 files = _ls_tree(fs, "/", maxdepth=2)
1051 assert _simplify_tree(files) == {
1052 "/": {
1053 ".gitignore": None,
1054 "README.md": None,
1055 "model": {
1056 "script.py": None,
1057 "train.py": None,
1058 },
1059 }
1060 }
1061
1062 files = _ls_tree(fs, "README.md", maxdepth=3)
1063 assert _simplify_tree(files) == {"README.md": None}

Callers

nothing calls this directly

Calls 3

_ls_treeFunction · 0.90
_simplify_treeFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected