def with_table_columns(self): cols = [TableColumn(**d) for d in self.spec] table = DynamicTable("with_table_columns", 'PyNWB unit test', 'a test table', columns=cols) return table
def test_constructor_ids_default(self): columns = [ TableColumn(name=s['name'], description=s['description'], data=d) for s, d in zip(self.spec, self.data) ] table = DynamicTable("with_spec", 'a test table', columns=columns) self.check_table(table)
def with_columns_and_data(self): columns = [ TableColumn(name=s['name'], description=s['description'], data=d) for s, d in zip(self.spec, self.data) ] return DynamicTable("with_columns_and_data", 'a test table', columns=columns)
def test_constructor_ids(self): columns = [ TableColumn(name=s['name'], description=s['description'], data=d) for s, d in zip(self.spec, self.data) ] table = DynamicTable("with_columns", 'PyNWB unit test', 'a test table', ids=[0, 1, 2, 3, 4], columns=columns) self.check_table(table)
def test_constructor_ids_bad_ids(self): columns = [ TableColumn(name=s['name'], description=s['description'], data=d) for s, d in zip(self.spec, self.data) ] msg = "must provide same number of ids as length of columns" with self.assertRaisesRegex(ValueError, msg): DynamicTable("with_columns", 'a test table', id=[0, 1], columns=columns)
def test_constructor_ElementIdentifier_ids(self): columns = [ TableColumn(name=s['name'], description=s['description'], data=d) for s, d in zip(self.spec, self.data) ] ids = ElementIdentifiers('ids', [0, 1, 2, 3, 4]) table = DynamicTable("with_columns", 'a test table', id=ids, columns=columns) self.check_table(table)