summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-14 21:11:16 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-14 21:11:51 -0400
commitdbc8bbfba3591d2ea704673d90e95014765d0f10 (patch)
tree274df91b7f0217d8bff7b8d9f3e6e4d6bd6365a0 /test/sql
parentd2193f53c10d29a7a9b1846ebf322fbced55041f (diff)
downloadsqlalchemy-dbc8bbfba3591d2ea704673d90e95014765d0f10.tar.gz
- allow the compilation rule that gets the formatted name
to again have the chance to veto rendering, as the naming convention can make the decision that the name is "none" or not now.
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_metadata.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py
index 7aa2059dc..ee7d372d7 100644
--- a/test/sql/test_metadata.py
+++ b/test/sql/test_metadata.py
@@ -3013,6 +3013,25 @@ class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL):
schema.CreateTable(u1).compile
)
+ def test_schematype_no_ck_name_boolean_no_name(self):
+ m1 = MetaData() # no naming convention
+
+ u1 = Table(
+ 'user', m1,
+ Column('x', Boolean())
+ )
+ # constraint gets special _defer_none_name
+ eq_(
+ [c for c in u1.constraints
+ if isinstance(c, CheckConstraint)][0].name, "_unnamed_"
+ )
+
+ self.assert_compile(
+ schema.CreateTable(u1),
+ "CREATE TABLE user (x BOOLEAN, CHECK (x IN (0, 1)))"
+ )
+
+
def test_ck_constraint_redundant_event(self):
u1 = self._fixture(naming_convention={
"ck": "ck_%(table_name)s_%(constraint_name)s"})