Exemplo n.º 1
0
    def test_column_representation(self):
        col_a, col_b = Column('a', Char()), Column('b', Char(100))

        with self.subTest('without argument'):
            self.assertEqual('a CHAR', str(col_a))

        with self.subTest('with argument'):
            self.assertEqual('b CHAR(100)', str(col_b))
Exemplo n.º 2
0
    def test_as_database_column(self):
        col_a, col_b = Column('a', Char()), Column('b', Char(100))

        with self.subTest('without argument'):
            self.assertEqual('a char',
                             col_a.to_database_column(self.type_engine))

        with self.subTest('with argument'):
            self.assertEqual('b char(100)',
                             col_b.to_database_column(self.type_engine))
Exemplo n.º 3
0
    def test_as_pypika_column(self):
        col_a, col_b = Column('a', Char()), Column('b', Char(100))

        pypika_col_a, pypika_col_b = col_a.to_pypika_column(
            self.type_engine), col_b.to_pypika_column(self.type_engine)

        with self.subTest('without argument'):
            self.assertTrue(isinstance(pypika_col_a, PypikaColumn))
            self.assertEqual('"a" char', str(pypika_col_a))

        with self.subTest('with argument'):
            self.assertTrue(isinstance(pypika_col_b, PypikaColumn))
            self.assertEqual('"b" char(100)', str(pypika_col_b))
Exemplo n.º 4
0
    def setUpClass(cls):
        cls.mysql = MySQLDatabase(database='mysql')
        cls.vertica = VerticaDatabase()

        cls.db_cols = [['a', 'nvarchar'], ['b', 'varchar(100)']]
        cls.ansi_cols = [Column('a', VarChar()), Column('b', VarChar(100))]