Пример #1
0
def test_download():
    dataset_path = './tests/data'
    dataset = Dataset(dataset_path)
    dataset.set_as_downloaded()
    dir_path = os.path.dirname(os.path.realpath(__file__))
    url = 'file:////' + os.path.join(dir_path, 'resources')
    files = ['remote.zip']
    unzip_file = os.path.join(dataset_path, 'remote.wav')
    _clean(unzip_file)
    assert not dataset.download(url, files, force_download=False)
    file_log = os.path.join(dataset_path, 'download.txt')
    _clean(file_log)
    resp = dataset.download(url, files, force_download=True)
    assert resp
    assert os.path.exists(unzip_file)
    _clean(unzip_file)
Пример #2
0
def test_download():
    dataset_path = "./tests/data"
    dataset = Dataset(dataset_path)
    dataset.set_as_downloaded()
    dir_path = os.path.dirname(os.path.realpath(__file__))
    url = "file:////" + os.path.join(dir_path, "resources")
    files = ["remote.zip"]
    unzip_file = os.path.join(dataset_path, "remote.wav")
    _clean(unzip_file)
    assert not dataset.download(url, files, force_download=False)
    file_log = os.path.join(dataset_path, "download.txt")
    _clean(file_log)
    resp = dataset.download(url, files, force_download=True)
    assert resp
    assert os.path.exists(unzip_file)
    _clean(unzip_file)