Exemple #1
0
def test_set_as_downloaded():
    dataset_path = './tests/data'
    dataset = Dataset(dataset_path)
    file_log = os.path.join(dataset_path, 'download.txt')
    _clean(file_log)
    dataset.set_as_downloaded()
    assert os.path.exists(file_log)
Exemple #2
0
def test_check_if_downloaded():
    dataset_path = './tests/data'
    dataset = Dataset(dataset_path)
    file_log = os.path.join(dataset_path, 'download.txt')
    _clean(file_log)
    assert not dataset.check_if_downloaded()
    dataset.set_as_downloaded()
    assert dataset.check_if_downloaded()
Exemple #3
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)
Exemple #4
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)