def test_glob(): d = {"accounts1.csv": "name,when\nAlice,100\nBob,200", "accounts2.csv": "name,when\nAlice,300\nBob,400"} with filetexts(d) as fns: r = resource("accounts*.csv", has_header=True) assert convert(list, r) == [("Alice", 100), ("Bob", 200), ("Alice", 300), ("Bob", 400)] r = resource("*.csv") assert isinstance(r, chunks(CSV))
def test_glob(): d = {'accounts1.csv': 'name,when\nAlice,100\nBob,200', 'accounts2.csv': 'name,when\nAlice,300\nBob,400'} with filetexts(d) as fns: r = resource('accounts*.csv', has_header=True) assert convert(list, r) == [('Alice', 100), ('Bob', 200), ('Alice', 300), ('Bob', 400)] r = resource('*.csv') assert isinstance(r, chunks(CSV))
def test_discover_with_dotted_names(): with tmpfile('.csv') as fn: with open(fn, 'w') as f: f.write('a.b,c.d\n1,2\n3,4') dshape = discover(resource(fn)) assert dshape == datashape.dshape('var * {"a.b": int64, "c.d": int64}') assert dshape.measure.names == [u'a.b', u'c.d']
def test_discover_with_dotted_names(): with tmpfile(".csv") as fn: with open(fn, "w") as f: f.write("a.b,c.d\n1,2\n3,4") dshape = discover(resource(fn)) assert dshape == datashape.dshape('var * {"a.b": int64, "c.d": int64}') assert dshape.measure.names == [u"a.b", u"c.d"]