Example #1
0
    def test___str__(self):
        col = Column(flags=COLUMN_SCALAR, type=ShortText)
        self.assertRaises(TypeError, col.__str__)

        col = Column(flags=COLUMN_SCALAR, type=ShortText)
        col.tablename = 'tb1'
        self.assertRaises(TypeError, col.__str__)

        col = Column(flags=COLUMN_SCALAR, type=ShortText)
        col.name = 'name1'
        self.assertRaises(TypeError, col.__str__)

        col = Column(flags=COLUMN_VECTOR, type=ShortText)
        col.tablename = 'tb2'
        col.name = 'name2'
        self.assertEqual(col.__str__(), 'column_create --table tb2 ' \
                '--name name2 --flags COLUMN_VECTOR --type ShortText')