diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 13:46:45 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 13:46:45 -0500 |
commit | 133a0b2460f4c71692795ebbe52f9e521bb8782c (patch) | |
tree | ce469b81e8b4f1553ea83ee3c091797e227640f6 /test/sql/test_constraints.py | |
parent | 3867ea9dc7b432f84d29496c1824486b14cd8bfa (diff) | |
download | sqlalchemy-133a0b2460f4c71692795ebbe52f9e521bb8782c.tar.gz |
- [bug] the "name" of a column-level CHECK constraint,
if present, is now rendered in the CREATE TABLE
statement using "CONSTRAINT <name> CHECK <expression>".
[ticket:2305]
Diffstat (limited to 'test/sql/test_constraints.py')
-rw-r--r-- | test/sql/test_constraints.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index db7271e05..79a32d44b 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -295,6 +295,15 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): assert 'NOT DEFERRABLE' not in sql assert 'INITIALLY DEFERRED' in sql + def test_column_level_ck_name(self): + t = Table('tbl', MetaData(), + Column('a', Integer, CheckConstraint("a > 5", name="ck_a_greater_five")) + ) + self.assert_compile( + schema.CreateTable(t), + "CREATE TABLE tbl (a INTEGER CONSTRAINT " + "ck_a_greater_five CHECK (a > 5))" + ) def test_deferrable_pk(self): factory = lambda **kw: PrimaryKeyConstraint('a', **kw) self._test_deferrable(factory) @@ -312,7 +321,9 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL): self.assert_compile( schema.CreateTable(t), - "CREATE TABLE tbl (a INTEGER, b INTEGER, FOREIGN KEY(b) REFERENCES tbl (a) DEFERRABLE INITIALLY DEFERRED)", + "CREATE TABLE tbl (a INTEGER, b INTEGER, " + "FOREIGN KEY(b) REFERENCES tbl " + "(a) DEFERRABLE INITIALLY DEFERRED)", ) def test_deferrable_unique(self): |