Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)