Column(Integer(), ForeignKey('bat.blah'), doc="this is a col"),
Column('bar', Integer(), ForeignKey('bat.blah'), primary_key=True,
key='bar'),
- Column('bar', Integer(), info={'foo':'bar'}),
+ Column('bar', Integer(), info={'foo': 'bar'}),
]:
c2 = col.copy()
for attr in ('name', 'type', 'nullable',
def test_dupe_tables(self):
metadata = self.metadata
Table('table1', metadata,
- Column('col1', Integer, primary_key=True),
- Column('col2', String(20)))
+ Column('col1', Integer, primary_key=True),
+ Column('col2', String(20)))
metadata.create_all()
Table('table1', metadata, autoload=True)
def go():
Table('table1', metadata,
- Column('col1', Integer, primary_key=True),
- Column('col2', String(20)))
+ Column('col1', Integer, primary_key=True),
+ Column('col2', String(20)))
assert_raises_message(
tsa.exc.InvalidRequestError,
- "Table 'table1' is already defined for this "\
- "MetaData instance. Specify 'extend_existing=True' "\
- "to redefine options and columns on an existing "\
- "Table object.",
+ "Table 'table1' is already defined for this "
+ "MetaData instance. Specify 'extend_existing=True' "
+ "to redefine options and columns on an existing "
+ "Table object.",
go
)
for i, (name, metadata, schema, quote_schema,
exp_schema, exp_quote_schema) in enumerate([
- ('t1', m1, None, None, 'sch1', None),
- ('t2', m1, 'sch2', None, 'sch2', None),
- ('t3', m1, 'sch2', True, 'sch2', True),
- ('t4', m1, 'sch1', None, 'sch1', None),
- ('t1', m2, None, None, 'sch1', True),
- ('t2', m2, 'sch2', None, 'sch2', None),
- ('t3', m2, 'sch2', True, 'sch2', True),
- ('t4', m2, 'sch1', None, 'sch1', None),
- ('t1', m3, None, None, 'sch1', False),
- ('t2', m3, 'sch2', None, 'sch2', None),
- ('t3', m3, 'sch2', True, 'sch2', True),
- ('t4', m3, 'sch1', None, 'sch1', None),
- ('t1', m4, None, None, None, None),
- ('t2', m4, 'sch2', None, 'sch2', None),
- ('t3', m4, 'sch2', True, 'sch2', True),
- ('t4', m4, 'sch1', None, 'sch1', None),
- ]):
+ ('t1', m1, None, None, 'sch1', None),
+ ('t2', m1, 'sch2', None, 'sch2', None),
+ ('t3', m1, 'sch2', True, 'sch2', True),
+ ('t4', m1, 'sch1', None, 'sch1', None),
+ ('t1', m2, None, None, 'sch1', True),
+ ('t2', m2, 'sch2', None, 'sch2', None),
+ ('t3', m2, 'sch2', True, 'sch2', True),
+ ('t4', m2, 'sch1', None, 'sch1', None),
+ ('t1', m3, None, None, 'sch1', False),
+ ('t2', m3, 'sch2', None, 'sch2', None),
+ ('t3', m3, 'sch2', True, 'sch2', True),
+ ('t4', m3, 'sch1', None, 'sch1', None),
+ ('t1', m4, None, None, None, None),
+ ('t2', m4, 'sch2', None, 'sch2', None),
+ ('t3', m4, 'sch2', True, 'sch2', True),
+ ('t4', m4, 'sch1', None, 'sch1', None),
+ ]):
kw = {}
if schema is not None:
kw['schema'] = schema
kw['quote_schema'] = quote_schema
t = Table(name, metadata, **kw)
eq_(t.schema, exp_schema, "test %d, table schema" % i)
- eq_(t.quote_schema, exp_quote_schema, "test %d, table quote_schema" % i)
+ eq_(t.quote_schema, exp_quote_schema,
+ "test %d, table quote_schema" % i)
seq = Sequence(name, metadata=metadata, **kw)
eq_(seq.schema, exp_schema, "test %d, seq schema" % i)
- eq_(seq.quote_schema, exp_quote_schema, "test %d, seq quote_schema" % i)
+ eq_(seq.quote_schema, exp_quote_schema,
+ "test %d, seq quote_schema" % i)
def test_manual_dependencies(self):
meta = MetaData()
Column("col1", Integer),
prefixes=["VIRTUAL"])
self.assert_compile(
- schema.CreateTable(table2),
- "CREATE VIRTUAL TABLE temporary_table_2 (col1 INTEGER)"
+ schema.CreateTable(table2),
+ "CREATE VIRTUAL TABLE temporary_table_2 (col1 INTEGER)"
)
def test_table_info(self):
Unicode), autoload=True)
assert_raises_message(
exc.InvalidRequestError,
- "Table 'users' is already defined for this "\
+ "Table 'users' is already defined for this "\
"MetaData instance.",
go
)
def test_all_events(self):
canary = []
def before_attach(obj, parent):
- canary.append("%s->%s" % (obj.__class__.__name__, parent.__class__.__name__))
+ canary.append("%s->%s" % (obj.__class__.__name__,
+ parent.__class__.__name__))
def after_attach(obj, parent):
canary.append("%s->%s" % (obj.__class__.__name__, parent))
def evt(target):
def before_attach(obj, parent):
- canary.append("%s->%s" % (target.__name__, parent.__class__.__name__))
+ canary.append("%s->%s" % (target.__name__,
+ parent.__class__.__name__))
def after_attach(obj, parent):
canary.append("%s->%s" % (target.__name__, parent))
event.listen(target, "after_parent_attach", after_attach)
for target in [
- schema.ForeignKeyConstraint, schema.PrimaryKeyConstraint, schema.UniqueConstraint,
+ schema.ForeignKeyConstraint, schema.PrimaryKeyConstraint,
+ schema.UniqueConstraint,
schema.CheckConstraint
]:
evt(target)
eq_(
canary,
[
- 'PrimaryKeyConstraint->Table', 'PrimaryKeyConstraint->t1',
- 'ForeignKeyConstraint->Table', 'ForeignKeyConstraint->t1',
- 'UniqueConstraint->Table', 'UniqueConstraint->t1',
- 'PrimaryKeyConstraint->Table', 'PrimaryKeyConstraint->t2',
- 'CheckConstraint->Table', 'CheckConstraint->t2',
- 'UniqueConstraint->Table', 'UniqueConstraint->t2'
+ 'PrimaryKeyConstraint->Table', 'PrimaryKeyConstraint->t1',
+ 'ForeignKeyConstraint->Table', 'ForeignKeyConstraint->t1',
+ 'UniqueConstraint->Table', 'UniqueConstraint->t1',
+ 'PrimaryKeyConstraint->Table', 'PrimaryKeyConstraint->t2',
+ 'CheckConstraint->Table', 'CheckConstraint->t2',
+ 'UniqueConstraint->Table', 'UniqueConstraint->t2'
]
)