class SequenceColumnTestCase(TestCase): def setUp(self): self.column = SequenceColumn("foo", headers=["A", "B", "C"]) def test_create_instance(self): self.assertEqual(self.column.headers, ["A", "B", "C"]) def test_length(self): self.assertEqual(len(self.column), 3) def test_getitem(self): col = self.column[0] self.assertEqual(col.field, "foo.0") self.assertEqual(col.header.text, "A") def test_extend_columns(self): columns = [] columns.extend(self.column) self.assertEqual(len(columns), 3) def test_get_field(self): self.assertEqual(self.column.get_field(0), "foo.0") self.assertEqual(self.column.get_field(1), "foo.1") self.assertEqual(self.column.get_field(2), "foo.2") def test_get_column(self): column0 = self.column.get_column(0) self.assertEqual(column0.field, "foo.0") self.assertEqual(column0.header.text, "A") def test_columns_property(self): self.assertTrue(isinstance(self.column.columns, list)) self.assertEqual(len(self.column.columns), 3) self.assertEqual(self.column.columns[0].field, "foo.0") self.assertEqual(self.column.columns[1].field, "foo.1") self.assertEqual(self.column.columns[2].field, "foo.2")
def setUp(self): self.column = SequenceColumn("foo", headers=["A", "B", "C"])
class SequenceColumnTable(Table): id = Column(field='id', header=u'#') seq = SequenceColumn(field='calendar', headers=["A", "B", "C", "D", "E"])