def test_client(tmpdir, data): # construct with a path to a file csv = tmpdir for k, v in data.items(): f = csv / '{}.csv'.format(k) v.to_csv(str(f), index=False) c = CSVClient(csv / 'open.csv') assert c.list_databases() == [] assert c.list_tables() == ['open'] c = CSVClient(csv / 'close.csv') assert c.list_databases() == [] assert c.list_tables() == ['close']
def test_insert(transformed, tmpdir): t = transformed # csv's don't preserve dtypes expected = execute(t) expected['time'] = expected['time'].astype(str) tpath = tmpdir / 'new_csv' tpath.mkdir() path = tpath / 'foo.csv' assert not path.exists() c = ibis.csv.connect(tpath) c.insert('foo.csv', t) assert path.exists() # readback t = CSVClient(str(tpath)).database() result = t.list_tables() assert result == ['foo'] result = t.foo.execute() tm.assert_frame_equal(result, expected)