def test_annotateAndAnnotated(self):
        # There's a bug somewhere which means annotating the table with the
        # version annotation, then using the table as a FileAnnotation on
        # an object, causes the version annotation to be lost
        # Closing and reopening the table seems to work (see
        # FeatureTable.createTable)
        cli, sess = self.create_client()
        ft = FeatureTable(client=cli, tableName=self.tableName)
        fts = ['a [0]', 'a [1]', 'b [0]']
        ft.createTable(fts, version=self.version)
        tid = ft.tc.tableId

        self.assertEqual(self.version, unwrapVersion(ft.versiontag))

        vertag = WndcharmStorage.getVersion(ft.conn, 'OriginalFile', tid)
        self.assertEqual(self.version, unwrapVersion(vertag))

        p = omero.model.ProjectI()
        p.setName(wrap('tmp'))
        p = self.sess.getUpdateService().saveAndReturnObject(p)
        pid = unwrap(p.getId())
        p = ft.conn.getObject('Project', pid)
        WndcharmStorage.addFileAnnotationTo(ft.tc, p)

        vertag = WndcharmStorage.getVersion(ft.conn, 'OriginalFile', tid)
        self.assertEqual(self.version, unwrapVersion(vertag))
        self.delete('/Project', pid)
        self.delete('/OriginalFile', tid)
 def create_table(self):
     cli, sess = self.create_client()
     ft = FeatureTable(client=cli, tableName=self.tableName)
     fts = ['a [0]', 'a [1]', 'b [0]']
     ft.createTable(fts, version=self.version)
     tid = ft.tc.tableId
     ft.close()
     return tid
    def create_table_with_data(self):
        cli, sess = self.create_client()
        ft = FeatureTable(client=cli, tableName=self.tableName)
        fts = ['a [0]', 'a [1]', 'b [0]']
        ft.createTable(fts, version=self.version)

        cols = ft.tc.getHeaders()
        cols[0].values = [7, 8]
        cols[1].values = [[1., 2.], [3., 4.]]
        cols[2].values = [[5.], [6.]]
        ft.tc.addData(cols)

        tid = ft.tc.tableId
        ft.close()
        return tid