def test_open_table(self):
        tid, tcols, meta, ftnames = TableStoreHelper.create_table(
            self.sess, self.ft_space, self.name, [1], 'multi', False)

        store = FeatureTable(
            self.sess, self.name, self.ft_space, self.ann_space)
        store.open_table(tid)
        assert store.table
        TableStoreHelper.assert_coltypes_equal(store.cols, tcols)
        assert store.metadata_names() == tuple(m[1] for m in meta)
        assert store.feature_names() == ftnames

        store.close()
    def test_open_table(self):
        tid, tcols, meta, ftnames = TableStoreHelper.create_table(
            self.sess, self.ft_space, self.name, [1], "multi", False
        )

        store = FeatureTable(self.sess, self.name, self.ft_space, self.ann_space)
        store.open_table(tid)
        assert store.table
        TableStoreHelper.assert_coltypes_equal(store.cols, tcols)
        assert store.metadata_names() == tuple(m[1] for m in meta)
        assert store.feature_names() == ftnames

        store.close()
    def test_new_table(self):
        tcols, meta, ftnames = TableStoreHelper.get_columns([2], "multi", False)

        store = FeatureTable(self.sess, self.name, self.ft_space, self.ann_space)
        store.new_table(meta, ftnames)
        assert store.table
        TableStoreHelper.assert_coltypes_equal(store.cols, tcols)

        assert store.metadata_names() == tuple(m[1] for m in meta)
        assert store.feature_names() == ftnames

        # Need to reload
        # ofile = store.table.getOriginalFile()
        tid = unwrap(store.table.getOriginalFile().getId())
        ofile = self.sess.getQueryService().get("OriginalFile", tid)
        assert unwrap(ofile.getName()) == self.name
        assert unwrap(ofile.getPath()) == self.ft_space

        store.close()
    def test_new_table(self):
        tcols, meta, ftnames = TableStoreHelper.get_columns(
            [2], 'multi', False)

        store = FeatureTable(
            self.sess, self.name, self.ft_space, self.ann_space)
        store.new_table(meta, ftnames)
        assert store.table
        TableStoreHelper.assert_coltypes_equal(store.cols, tcols)

        assert store.metadata_names() == tuple(m[1] for m in meta)
        assert store.feature_names() == ftnames

        # Need to reload
        # ofile = store.table.getOriginalFile()
        tid = unwrap(store.table.getOriginalFile().getId())
        ofile = self.sess.getQueryService().get('OriginalFile', tid)
        assert unwrap(ofile.getName()) == self.name
        assert unwrap(ofile.getPath()) == self.ft_space

        store.close()