Ejemplo n.º 1
0
def test_catalog_url_construction_from_relative_url():
    url = 'https://raw.githubusercontent.com/NCAR/cesm-lens-aws/master/intake-catalogs/aws-cesm1-le.json'
    catalog_file = 'https://raw.githubusercontent.com/NCAR/cesm-lens-aws/master/intake-catalogs/aws-cesm1-le.csv'
    data, path = _fetch_and_parse_json(url)
    df, cat_file = _fetch_catalog(data, path)
    assert isinstance(df, pd.DataFrame)
    assert catalog_file == cat_file
Ejemplo n.º 2
0
def test_catalog_url_construction_from_relative_url():
    url = 'https://raw.githubusercontent.com/intake/intake-esm/master/tests/sample-collections/cesm1-lens-netcdf.json'
    catalog_file = 'https://raw.githubusercontent.com/intake/intake-esm/master/tests/sample-collections/cesm1-lens-netcdf.csv'
    data, path = _fetch_and_parse_json(url)
    df, cat_file = _fetch_catalog(data, path)
    assert isinstance(df, pd.DataFrame)
    assert catalog_file == cat_file
Ejemplo n.º 3
0
def test_catalog_url_construction_from_relative_url_error():
    url = 'https://raw.githubusercontent.com/NCAR/cesm-lens-aws/master/intake-catalogs/aws-cesm1-le.json'
    data, path = _fetch_and_parse_json(url)
    data['catalog_file'] = 'DONT_EXIST'
    with pytest.raises(FileNotFoundError):
        _fetch_catalog(data, path)
Ejemplo n.º 4
0
def test_fetch_catalog_local_error(sample_bad_input):
    data, path = _fetch_and_parse_json(sample_bad_input)
    with pytest.raises(FileNotFoundError):
        _fetch_catalog(data, path)
Ejemplo n.º 5
0
def test_catalog_url_construction_from_relative_url_error():
    url = 'https://raw.githubusercontent.com/intake/intake-esm/master/tests/sample-collections/cesm1-lens-netcdf.json'
    data, path = _fetch_and_parse_json(url)
    data['catalog_file'] = 'DONT_EXIST'
    with pytest.raises(FileNotFoundError):
        _fetch_catalog(data, path)
Ejemplo n.º 6
0
def test_catalog_csv_kwargs(esmcol_path, csv_kwargs):
    data, path = _fetch_and_parse_json(esmcol_path)
    df, _ = _fetch_catalog(data, esmcol_path, csv_kwargs=csv_kwargs)
    assert isinstance(df.iloc[0].variable, list)