From: Mike Bayer Date: Wed, 5 Jun 2013 03:20:02 +0000 (-0400) Subject: genericize tests here X-Git-Tag: rel_0_8_2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4e59730d54154c955b0c7655c0ff27ce4e0de6e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git genericize tests here --- diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 026095c3bd..b44a651904 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -1,9 +1,12 @@ from sqlalchemy.testing import assert_raises, assert_raises_message -from sqlalchemy import * +from sqlalchemy import Table, Integer, String, Column, PrimaryKeyConstraint,\ + ForeignKeyConstraint, ForeignKey, UniqueConstraint, Index, MetaData, \ + CheckConstraint, func from sqlalchemy import exc, schema from sqlalchemy.testing import fixtures, AssertsExecutionResults, \ AssertsCompiledSQL from sqlalchemy import testing +from sqlalchemy.engine import default from sqlalchemy.testing import engines from sqlalchemy.testing import eq_ from sqlalchemy.testing.assertsql import AllOf, RegexSQL, ExactSQL, CompiledSQL @@ -423,12 +426,14 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): ) def _test_deferrable(self, constraint_factory): + dialect = default.DefaultDialect() + t = Table('tbl', MetaData(), Column('a', Integer), Column('b', Integer), constraint_factory(deferrable=True)) - sql = str(schema.CreateTable(t).compile(bind=testing.db)) + sql = str(schema.CreateTable(t).compile(dialect=dialect)) assert 'DEFERRABLE' in sql, sql assert 'NOT DEFERRABLE' not in sql, sql @@ -437,7 +442,7 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): Column('b', Integer), constraint_factory(deferrable=False)) - sql = str(schema.CreateTable(t).compile(bind=testing.db)) + sql = str(schema.CreateTable(t).compile(dialect=dialect)) assert 'NOT DEFERRABLE' in sql @@ -445,7 +450,7 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): Column('a', Integer), Column('b', Integer), constraint_factory(deferrable=True, initially='IMMEDIATE')) - sql = str(schema.CreateTable(t).compile(bind=testing.db)) + sql = str(schema.CreateTable(t).compile(dialect=dialect)) assert 'NOT DEFERRABLE' not in sql assert 'INITIALLY IMMEDIATE' in sql @@ -453,7 +458,7 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): Column('a', Integer), Column('b', Integer), constraint_factory(deferrable=True, initially='DEFERRED')) - sql = str(schema.CreateTable(t).compile(bind=testing.db)) + sql = str(schema.CreateTable(t).compile(dialect=dialect)) assert 'NOT DEFERRABLE' not in sql assert 'INITIALLY DEFERRED' in sql