diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-04 23:20:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-04 23:20:02 -0400 |
commit | 9a736a4c6e3a21a4d3682a0bd2b547ef0703a027 (patch) | |
tree | 6f0cca40513792213d6ef6ad3d0f45157da4c5bb | |
parent | 26ec0507be72d2e1a5abde8b7307012864a88a6b (diff) | |
download | sqlalchemy-9a736a4c6e3a21a4d3682a0bd2b547ef0703a027.tar.gz |
genericize tests here
-rw-r--r-- | test/sql/test_constraints.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 026095c3b..b44a65190 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 |