summaryrefslogtreecommitdiff
path: root/test/sql/labels.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-06-22 16:56:16 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-06-22 16:56:16 +0000
commitb2b754c2ce3a9672a135f01246dcb9521a88e2c4 (patch)
treef8fa80996b3087adbf63c915d38a9f34c95f786f /test/sql/labels.py
parentbe2d349ade99ff83580f4197f3afa823f6be3b3a (diff)
downloadsqlalchemy-b2b754c2ce3a9672a135f01246dcb9521a88e2c4.tar.gz
- merged r4868, disallow overly long names from create/drop, from 0.4 branch, [ticket:571]
Diffstat (limited to 'test/sql/labels.py')
-rw-r--r--test/sql/labels.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sql/labels.py b/test/sql/labels.py
index 78b31adc4..3e025e5e7 100644
--- a/test/sql/labels.py
+++ b/test/sql/labels.py
@@ -1,5 +1,6 @@
import testenv; testenv.configure_for_tests()
from sqlalchemy import *
+from sqlalchemy import exc as exceptions
from testlib import *
from sqlalchemy.engine import default
@@ -38,6 +39,14 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
metadata.drop_all()
testing.db.dialect.max_identifier_length = maxlen
+ def test_too_long_name_disallowed(self):
+ m = MetaData(testing.db)
+ t1 = Table("this_name_is_too_long_for_what_were_doing_in_this_test", m, Column('foo', Integer))
+ self.assertRaises(exceptions.IdentifierError, m.create_all)
+ self.assertRaises(exceptions.IdentifierError, m.drop_all)
+ self.assertRaises(exceptions.IdentifierError, t1.create)
+ self.assertRaises(exceptions.IdentifierError, t1.drop)
+
def test_result(self):
table1.insert().execute(**{"this_is_the_primarykey_column":1, "this_is_the_data_column":"data1"})
table1.insert().execute(**{"this_is_the_primarykey_column":2, "this_is_the_data_column":"data2"})