Ejemplo n.º 1
0
def test_download_not_found(storage):

    with pytest.raises(FileNotFoundError):
        storage.download(filename="not_found", savepath=SAVEPATH)

    with pytest.raises(FileNotFoundError):
        storage.download(savepath=SAVEPATH)
Ejemplo n.º 2
0
def test_download_filename(storage):

    storage.download(filename="municipio.csv",
                     savepath=SAVEPATH,
                     mode="staging")

    assert (Path(SAVEPATH) / "staging" / DATASET_ID / TABLE_ID /
            "municipio.csv").is_file()
Ejemplo n.º 3
0
def test_download_default(storage):
    storage.download(savepath=SAVEPATH, mode="staging")

    assert (Path(SAVEPATH) / "staging" / DATASET_ID / TABLE_ID /
            "municipios.csv").is_file()

    assert (Path(SAVEPATH) / "staging" / DATASET_ID / TABLE_ID /
            "municipios2.csv").is_file()
Ejemplo n.º 4
0
def test_download_partitions(storage):

    storage.download(
        savepath=SAVEPATH,
        mode="staging",
        partitions="key1=value1/key2=value1/",
    )

    assert (Path(SAVEPATH) / "staging" / DATASET_ID / TABLE_ID /
            "key1=value1" / "key2=value1" / "municipio.csv").is_file()

    storage.download(
        savepath=SAVEPATH,
        mode="staging",
        partitions={
            "key1": "value1",
            "key2": "value2"
        },
    )

    assert (Path(SAVEPATH) / "staging" / DATASET_ID / TABLE_ID /
            "key1=value1" / "key2=value2" / "municipio.csv").is_file()