def test_get_table_rows(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() N = 16 pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) data = self.fill_table(pc, table_name, N) irange = range(N/4, (3*N)/4) selectors = ['(r_vid == "%s")' % data[i]['r_vid'] for i in irange] sel_classic = '|'.join(selectors) rows_classic = pc.get_table_rows(table_name, selector=sel_classic) for i, r in it.izip(irange, rows_classic): self.assertTrue(data[i] == r) sel_lite = selectors rows_lite = pc.get_table_rows(table_name, selector=sel_lite) for i, r in it.izip(irange, rows_classic): self.assertTrue(data[i] == r)
def test_table_rows(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() N = 16 pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) data = self.fill_table(pc, table_name, N) r = pc.get_table_rows(table_name, None) self.assertTrue(np.all(data == r)) m = N / 2 r = pc.get_table_rows(table_name, '(r_vid == "%s")' % data[m]['r_vid']) self.assertEqual(len(r), 1) self.assertTrue(data[m] == r[0]) pc.delete_table(table_name)
def test_table_rows_iterator(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() N = 16 pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) data = self.fill_table(pc, table_name, N) row_it = pc.get_table_rows_iterator(table_name) for i, row in enumerate(row_it): self.assertTrue(row == data[i]) pc.delete_table(table_name)
def test_create_delete(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) rec_desc = pc.get_table_headers(table_name) for f, n in it.izip(fields, rec_desc): self.assertEqual(f[1], n[0]) if f[0] == 'string': self.assertEqual('|S%d' % f[3], n[1]) elif f[0] == 'long': self.assertEqual('i8', n[1]) pc.delete_table(table_name)
def test_table_rows(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() N = 16 pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) data = self.fill_table(pc, table_name, N) r = pc.get_table_rows(table_name, None) self.assertTrue(np.all(data == r)) m = N/2 r = pc.get_table_rows(table_name, '(r_vid == "%s")' % data[m]['r_vid']) self.assertEqual(len(r), 1) self.assertTrue(data[m] == r[0]) pc.delete_table(table_name)
def test_get_table_rows(self): fields = self.make_fields() table_name = 'foo-%s.h5' % time.time() N = 16 pc = ProxyCore(OME_HOST, OME_USER, OME_PASS) pc.create_table(table_name, fields) data = self.fill_table(pc, table_name, N) irange = range(N / 4, (3 * N) / 4) selectors = ['(r_vid == "%s")' % data[i]['r_vid'] for i in irange] sel_classic = '|'.join(selectors) rows_classic = pc.get_table_rows(table_name, selector=sel_classic) for i, r in it.izip(irange, rows_classic): self.assertTrue(data[i] == r) sel_lite = selectors rows_lite = pc.get_table_rows(table_name, selector=sel_lite) for i, r in it.izip(irange, rows_classic): self.assertTrue(data[i] == r)