Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
allmonday committed May 5, 2023
1 parent 6ccbe9c commit 6fa3bc1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_autogen_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,28 @@ def test_generic_array_type(self):
"sa.ARRAY(sa.DateTime(timezone=True))",
)

def test_render_create_table_with_user_module_type(self):
class MyType(UserDefinedType):
def get_col_spec(self):
return "MYTYPE"

type_ = MyType()
uo = ops.UpgradeOps(
ops=[
ops.CreateTableOp(
"sometable", [Column("x", type_)]
)
]
)
eq_(
autogenerate.render_python_code(uo),
"# ### commands auto generated by Alembic - please adjust! ###\n"
" op.create_table('sometable',\n"
" sa.Column('x', tests.test_autogen_render.MyType(), nullable=True)\n"
" )\n"
" # ### end Alembic commands ###",
)

def test_render_array_no_context(self):
uo = ops.UpgradeOps(
ops=[
Expand Down

0 comments on commit 6fa3bc1

Please sign in to comment.