diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-14 22:44:33 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-14 22:44:33 -0400 |
| commit | f4653729a6ff952555c0192a5b0f0851c4d40ad5 (patch) | |
| tree | b6778b1455c76d58f61dc3aa4937cf0593ca86df /test/sql/test_metadata.py | |
| parent | dbc8bbfba3591d2ea704673d90e95014765d0f10 (diff) | |
| download | sqlalchemy-f4653729a6ff952555c0192a5b0f0851c4d40ad5.tar.gz | |
- wrestle with conv() and tests some more
Diffstat (limited to 'test/sql/test_metadata.py')
| -rw-r--r-- | test/sql/test_metadata.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index ee7d372d7..8bd419964 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -2813,7 +2813,7 @@ class DialectKWArgTest(fixtures.TestBase): class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL): - dialect = 'default' + __dialect__ = 'default' def _fixture(self, naming_convention, table_schema=None): m1 = MetaData(naming_convention=naming_convention) @@ -2957,7 +2957,7 @@ class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL): # but is hit at compile time self.assert_compile( schema.CreateTable(u1), - "CREATE TABLE user (" + 'CREATE TABLE "user" (' "x BOOLEAN, " "CONSTRAINT ck_user_foo CHECK (x IN (0, 1))" ")" @@ -2977,12 +2977,32 @@ class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL): # but is hit at compile time self.assert_compile( schema.CreateTable(u1), - "CREATE TABLE user (" + 'CREATE TABLE "user" (' "x VARCHAR(1), " "CONSTRAINT ck_user_foo CHECK (x IN ('a', 'b'))" ")" ) + def test_schematype_ck_name_propagate_conv(self): + m1 = MetaData(naming_convention={ + "ck": "ck_%(table_name)s_%(constraint_name)s"}) + + u1 = Table('user', m1, + Column('x', Enum('a', 'b', name=naming.conv('foo'))) + ) + eq_( + [c for c in u1.constraints + if isinstance(c, CheckConstraint)][0].name, "foo" + ) + # but is hit at compile time + self.assert_compile( + schema.CreateTable(u1), + 'CREATE TABLE "user" (' + "x VARCHAR(1), " + "CONSTRAINT foo CHECK (x IN ('a', 'b'))" + ")" + ) + def test_schematype_ck_name_boolean_no_name(self): m1 = MetaData(naming_convention={ "ck": "ck_%(table_name)s_%(constraint_name)s" @@ -3028,7 +3048,7 @@ class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL): self.assert_compile( schema.CreateTable(u1), - "CREATE TABLE user (x BOOLEAN, CHECK (x IN (0, 1)))" + 'CREATE TABLE "user" (x BOOLEAN, CHECK (x IN (0, 1)))' ) |
