summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-08-24 19:52:54 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-08-24 19:52:54 +0000
commit6f60e768837f6b91a75dc2d62dbd215471bf09f7 (patch)
tree3db99506d1901e0e809821816d899e8a81a8d370 /test/sql
parente01e972ac305d634cac3d63de6c5fa6688cd56c5 (diff)
downloadsqlalchemy-6f60e768837f6b91a75dc2d62dbd215471bf09f7.tar.gz
- The 'length' argument to all Numeric types has been renamed
to 'scale'. 'length' is deprecated and is still accepted with a warning. [ticket:827] - The 'length' argument to MSInteger, MSBigInteger, MSTinyInteger, MSSmallInteger and MSYear has been renamed to 'display_width'. [ticket:827] - mysql._Numeric now consumes 'unsigned' and 'zerofill' from the given kw, so that the same kw can be passed along to Numeric and allow the 'length' deprecation logic to still take effect - added testlib.engines.all_dialects() to return a dialect for every db module - informix added to sqlalchemy.databases.__all__. Since other "experimental" dbs like access and sybase are there, informix should be as well.
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/functions.py14
-rw-r--r--test/sql/testtypes.py30
2 files changed, 33 insertions, 11 deletions
diff --git a/test/sql/functions.py b/test/sql/functions.py
index 681d6a557..27e87eceb 100644
--- a/test/sql/functions.py
+++ b/test/sql/functions.py
@@ -5,22 +5,16 @@ from sqlalchemy.sql import table, column
from sqlalchemy import databases, sql, util
from sqlalchemy.sql.compiler import BIND_TEMPLATES
from sqlalchemy.engine import default
+from testlib.engines import all_dialects
from sqlalchemy import types as sqltypes
from testlib import *
from sqlalchemy.sql.functions import GenericFunction
from testlib.testing import eq_
from sqlalchemy.databases import *
-# every dialect in databases.__all__ is expected to pass these tests.
-dialects = [getattr(databases, mod).dialect()
- for mod in databases.__all__
- # fixme!
- if mod not in ('access',)]
-
-# if the configured dialect is out-of-tree or not yet in __all__, include it
-# too.
-if testing.db.name not in databases.__all__:
- dialects.append(testing.db.dialect)
+
+# FIXME!
+dialects = [d for d in all_dialects() if d.name not in ('access', 'informix')]
class CompileTest(TestBase, AssertsCompiledSQL):
diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py
index eaeac326b..345fbceac 100644
--- a/test/sql/testtypes.py
+++ b/test/sql/testtypes.py
@@ -4,6 +4,7 @@ import datetime, os, pickleable, re
from sqlalchemy import *
from sqlalchemy import exc, types, util
from sqlalchemy.sql import operators
+from testlib.testing import eq_
import sqlalchemy.engine.url as url
from sqlalchemy.databases import mssql, oracle, mysql, postgres, firebird
from testlib import *
@@ -728,7 +729,34 @@ class NumericTest(TestBase, AssertsExecutionResults):
assert isinstance(row['ncasdec'], decimal.Decimal)
assert isinstance(row['fcasdec'], decimal.Decimal)
-
+ def test_length_deprecation(self):
+ self.assertRaises(exc.SADeprecationWarning, Numeric, length=8)
+
+ @testing.uses_deprecated(".*is deprecated for Numeric")
+ def go():
+ n = Numeric(length=12)
+ assert n.scale == 12
+ go()
+
+ n = Numeric(scale=12)
+ for dialect in engines.all_dialects():
+ n2 = dialect.type_descriptor(n)
+ eq_(n2.scale, 12, dialect.name)
+
+ # test colspec generates successfully using 'scale'
+ assert n2.get_col_spec()
+
+ # test constructor of the dialect-specific type
+ n3 = n2.__class__(scale=5)
+ eq_(n3.scale, 5, dialect.name)
+
+ @testing.uses_deprecated(".*is deprecated for Numeric")
+ def go():
+ n3 = n2.__class__(length=6)
+ eq_(n3.scale, 6, dialect.name)
+ go()
+
+
class IntervalTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global interval_table, metadata