def test_sql_field_names_disagree_on_names(): r = resource('sqlite:///:memory:::tb', dshape=dshape('{x: int, y: int}')) assert raises(Exception, lambda: append(r, [(1, 2), (10, 20)], dshape=dshape('{x: int, z: int}')))
from odo import odo, resource, URL, discover, CSV, TextFile, convert from odo.backends.url import sample from odo.temp import _Temp, Temp from odo.utils import tmpfile, raises import datashape try: from urllib2 import urlopen from urllib2 import HTTPError, URLError except ImportError: from urllib.request import urlopen from urllib.error import HTTPError, URLError pytestmark = pytest.mark.skipif(raises(URLError, partial(urlopen, "http://google.com")), reason='unable to connect to google.com') iris_url = ('https://raw.githubusercontent.com/' 'blaze/blaze/master/blaze/examples/data/iris.csv') ftp_url = "ftp://athena-dist.mit.edu/pub/XNeXT/README.txt" def test_url_resource(): csv = resource(iris_url) assert isinstance(csv, URL(CSV)) def test_sample_different_line_counts(): with sample(resource(iris_url), lines=10) as fn: with open(fn, 'r') as f:
def test_raise_errors_quickly_on_into_chunks_dataframe(): with filetext('name,val\nAlice,100\nBob,foo', extension='csv') as fn: ds = datashape.dshape('var * {name: string, val: int}') csv = CSV(fn, header=True) assert raises(Exception, lambda: CSV_to_chunks_of_dataframes(csv, dshape=ds))
def test_raises_not_implemented_error(): assert raises(NotImplementedError, lambda: resource('5sdjkg9yg35420shfg083.3923.925y2560!'))