autogenerate._render_migration_diffs(context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
def test_render_nothing_batch(self):
context = MigrationContext.configure(
autogenerate._render_migration_diffs(context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
def test_render_diffs_standard(self):
"""test a full render including indentation"""
template_args = {}
autogenerate._render_migration_diffs(self.context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
op.create_table('item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=100), nullable=True),
nullable=False)
op.drop_index('pw_idx', table_name='user')
op.drop_column('user', 'pw')
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('pw', sa.VARCHAR(length=50), \
nullable=True))
op.create_index('pw_idx', 'user', ['pw'], unique=False)
sa.ForeignKeyConstraint(['uid'], ['user.id'], )
)
op.drop_table('item')
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
def test_render_diffs_batch(self):
"""test a full render in batch mode including indentation"""
autogenerate._render_migration_diffs(self.context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
op.create_table('item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=100), nullable=True),
batch_op.drop_index('pw_idx')
batch_op.drop_column('pw')
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('pw', sa.VARCHAR(length=50), nullable=True))
batch_op.create_index('pw_idx', ['pw'], unique=False)
sa.ForeignKeyConstraint(['uid'], ['user.id'], )
)
op.drop_table('item')
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
def test_imports_maintined(self):
template_args = {}
autogenerate._render_migration_diffs(context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
pass
- ### end Alembic commands ###""")
+ # ### end Alembic commands ###""")
def test_render_diffs_extras(self):
"""test a full render including indentation (include and schema)"""
autogenerate._render_migration_diffs(self.context, template_args)
eq_(re.sub(r"u'", "'", template_args['upgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
op.create_table('item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=100), nullable=True),
schema='%(schema)s')
op.drop_index('pw_idx', table_name='user', schema='test_schema')
op.drop_column('user', 'pw', schema='%(schema)s')
- ### end Alembic commands ###""" % {"schema": self.schema})
+ # ### end Alembic commands ###""" % {"schema": self.schema})
eq_(re.sub(r"u'", "'", template_args['downgrades']),
- """### commands auto generated by Alembic - please adjust! ###
+ """# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('pw', sa.VARCHAR(length=50), \
autoincrement=False, nullable=True), schema='%(schema)s')
op.create_index('pw_idx', 'user', ['pw'], unique=False, schema='%(schema)s')
schema='%(schema)s'
)
op.drop_table('item', schema='%(schema)s')
- ### end Alembic commands ###""" % {"schema": self.schema})
+ # ### end Alembic commands ###""" % {"schema": self.schema})