summaryrefslogtreecommitdiff
path: root/test/dialect
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-02-09 20:43:28 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-02-09 20:43:28 -0500
commitaf4239874242000f0dd38252ef0d35550d7bd21a (patch)
treebaf257145a2a9aa41e843764e68a3a15b9f3b003 /test/dialect
parent0843bbcfbb4ab57253e8de424b7b1b7538ba0781 (diff)
downloadsqlalchemy-af4239874242000f0dd38252ef0d35550d7bd21a.tar.gz
- The MySQL dialect now supports CAST on types that are constructed
as :class:`.TypeDecorator` objects.
Diffstat (limited to 'test/dialect')
-rw-r--r--test/dialect/mysql/test_compiler.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/dialect/mysql/test_compiler.py b/test/dialect/mysql/test_compiler.py
index 23341b9d2..304c31012 100644
--- a/test/dialect/mysql/test_compiler.py
+++ b/test/dialect/mysql/test_compiler.py
@@ -392,11 +392,22 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
(m.MSVarBinary, "CAST(t.col AS BINARY)"),
(m.MSVarBinary(32), "CAST(t.col AS BINARY)"),
+ (Interval, "CAST(t.col AS DATETIME)"),
+
]
for type_, expected in specs:
self.assert_compile(cast(t.c.col, type_), expected)
+ def test_cast_type_decorator(self):
+ class MyInteger(sqltypes.TypeDecorator):
+ impl = Integer
+
+ type_ = MyInteger()
+ t = sql.table('t', sql.column('col'))
+ self.assert_compile(
+ cast(t.c.col, type_), "CAST(t.col AS SIGNED INTEGER)")
+
def test_unsupported_casts(self):
t = sql.table('t', sql.column('col'))
@@ -413,7 +424,6 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
(m.MSYear, "t.col"),
(m.MSYear(2), "t.col"),
- (Interval, "t.col"),
(Boolean, "t.col"),
(BOOLEAN, "t.col"),