Ejemplo n.º 1
0
import pandas.util.testing as tm
from pandas import DataFrame
from pandas.io.parsers import read_csv, read_table


@pytest.fixture(scope='module')
def salaries_table():
    path = os.path.join(tm.get_data_path(), 'salaries.csv')
    return read_table(path)


@pytest.mark.parametrize(
    "compression,extension",
    [('gzip', '.gz'), ('bz2', '.bz2'), ('zip', '.zip'),
     pytest.mark.skipif(not tm._check_if_lzma(),
                        reason='need backports.lzma to run')(('xz', '.xz'))])
@pytest.mark.parametrize('mode', ['explicit', 'infer'])
@pytest.mark.parametrize('engine', ['python', 'c'])
def test_compressed_urls(salaries_table, compression, extension, mode, engine):
    check_compressed_urls(salaries_table, compression, extension, mode, engine)


@tm.network
def check_compressed_urls(salaries_table, compression, extension, mode,
                          engine):
    # test reading compressed urls with various engines and
    # extension inference
    base_url = ('https://github.com/pandas-dev/pandas/raw/master/'
                'pandas/tests/io/parser/data/salaries.csv')
Ejemplo n.º 2
0
import pandas.util.testing as tm
from pandas import DataFrame
from pandas.io.parsers import read_csv, read_table


@pytest.fixture(scope='module')
def salaries_table():
    path = os.path.join(tm.get_data_path(), 'salaries.csv')
    return read_table(path)


@pytest.mark.network
@pytest.mark.parametrize(
    "compression,extension",
    [('gzip', '.gz'), ('bz2', '.bz2'), ('zip', '.zip'),
     pytest.mark.skipif(not tm._check_if_lzma(),
                        reason='need backports.lzma to run')(('xz', '.xz'))])
@pytest.mark.parametrize('mode', ['explicit', 'infer'])
@pytest.mark.parametrize('engine', ['python', 'c'])
def test_compressed_urls(salaries_table, compression, extension, mode, engine):
    check_compressed_urls(salaries_table, compression, extension, mode, engine)


@tm.network
def check_compressed_urls(salaries_table, compression, extension, mode,
                          engine):
    # test reading compressed urls with various engines and
    # extension inference
    base_url = ('https://github.com/pandas-dev/pandas/raw/master/'
                'pandas/tests/io/parser/data/salaries.csv')