diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-09 20:43:28 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-09 20:43:28 -0500 |
| commit | af4239874242000f0dd38252ef0d35550d7bd21a (patch) | |
| tree | baf257145a2a9aa41e843764e68a3a15b9f3b003 /test/dialect | |
| parent | 0843bbcfbb4ab57253e8de424b7b1b7538ba0781 (diff) | |
| download | sqlalchemy-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.py | 12 |
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"), |
