From dbc8bbfba3591d2ea704673d90e95014765d0f10 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 14 Jul 2014 21:11:16 -0400 Subject: - 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. --- test/sql/test_metadata.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/sql') 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"}) -- cgit v1.2.1