Skip to content

Commit

Permalink
Add test for table comment
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hirschfeld committed Feb 11, 2020
1 parent ca84beb commit 6adae24
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,30 @@ class Simple(Base):
id = Column(Integer, primary_key=True, comment="this is a 'comment'")
"""

@pytest.mark.skipif(sqlalchemy.__version__ < '1.2', reason='Requires SQLAlchemy 1.2+')
def test_table_comment(metadata):
Table(
'simple', metadata,
Column('id', INTEGER, primary_key=True),
comment="this is a 'comment'"
)

assert generate_code(metadata) == """\
# coding: utf-8
from sqlalchemy import Column, Integer
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Simple(Base):
__tablename__ = 'simple'
__table_args__ = {'comment': "this is a 'comment'"}
id = Column(Integer, primary_key=True)
"""


@pytest.mark.parametrize('metadata', ['mysql'], indirect=['metadata'])
def test_mysql_timestamp(metadata):
Expand Down

0 comments on commit 6adae24

Please sign in to comment.