示例#1
0
文件: test_base.py 项目: ush98/dvc
def test_list_paths(dvc):
    path_info = PathInfo("foo")
    odb = ObjectDB(BaseFileSystem(), path_info)

    with mock.patch.object(odb.fs, "walk_files", return_value=[]) as walk_mock:
        for _ in odb._list_paths():
            pass
        walk_mock.assert_called_with(path_info, prefix=False)

        for _ in odb._list_paths(prefix="000"):
            pass
        walk_mock.assert_called_with(path_info / "00" / "0", prefix=True)
示例#2
0
文件: test_base.py 项目: efiop/dvc
def test_list_paths(dvc):
    path = "foo"
    odb = ObjectDB(FileSystem(), path)

    with mock.patch.object(odb.fs, "find", return_value=[]) as walk_mock:
        for _ in odb._list_paths():
            pass
        walk_mock.assert_called_with(path, prefix=False)

        for _ in odb._list_paths(prefix="000"):
            pass
        walk_mock.assert_called_with(posixpath.join(path, "00", "0"),
                                     prefix=True)