summaryrefslogtreecommitdiff
path: root/test/sql/test_constraints.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-24 11:17:16 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-24 11:17:16 -0400
commitc7c17e991cc53d201c8bb1e787efc313bebe8d4a (patch)
treeebc9ef7a77d1e31a1bc732d344e8c49b37a5a8f9 /test/sql/test_constraints.py
parent4af7743ce70bce50a8630ba91060101fc941281c (diff)
downloadsqlalchemy-c7c17e991cc53d201c8bb1e787efc313bebe8d4a.tar.gz
- [bug] Fixed the DropIndex construct to support
an Index associated with a Table in a remote schema. [ticket:2571]
Diffstat (limited to 'test/sql/test_constraints.py')
-rw-r--r--test/sql/test_constraints.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index 2869839dc..75a7cb2e1 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -9,6 +9,7 @@ from test.lib.assertsql import AllOf, RegexSQL, ExactSQL, CompiledSQL
from sqlalchemy.dialects.postgresql import base as postgresql
class ConstraintTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
+ __dialect__ = 'default'
def setup(self):
global metadata
@@ -285,6 +286,44 @@ class ConstraintTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled
Index, "foo", SomeClass()
)
+ def test_create_plain(self):
+ t = Table('t', MetaData(), Column('x', Integer))
+ i = Index("xyz", t.c.x)
+ self.assert_compile(
+ schema.CreateIndex(i),
+ "CREATE INDEX xyz ON t (x)"
+ )
+
+ def test_drop_plain_unattached(self):
+ self.assert_compile(
+ schema.DropIndex(Index(name="xyz")),
+ "DROP INDEX xyz"
+ )
+
+ def test_drop_plain(self):
+ t = Table('t', MetaData(), Column('x', Integer))
+ i = Index("xyz", t.c.x)
+ self.assert_compile(
+ schema.DropIndex(Index(name="xyz")),
+ "DROP INDEX xyz"
+ )
+
+ def test_create_schema(self):
+ t = Table('t', MetaData(), Column('x', Integer), schema="foo")
+ i = Index("xyz", t.c.x)
+ self.assert_compile(
+ schema.CreateIndex(i),
+ "CREATE INDEX xyz ON foo.t (x)"
+ )
+
+ def test_drop_schema(self):
+ t = Table('t', MetaData(), Column('x', Integer), schema="foo")
+ i = Index("xyz", t.c.x)
+ self.assert_compile(
+ schema.DropIndex(i),
+ "DROP INDEX foo.xyz"
+ )
+
class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = 'default'