summaryrefslogtreecommitdiff
path: root/test/sql/test_functions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-10 12:58:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-10 12:58:11 -0400
commitcd8b9dcd37e29b73a3c4b25adc16f1b45371fb7a (patch)
treef207c13c8a4cc11dceece70adec5e4c4ffe40bc8 /test/sql/test_functions.py
parent15170b74d2f556499ae3f8d35c2d9bf5120b9ebd (diff)
downloadsqlalchemy-cd8b9dcd37e29b73a3c4b25adc16f1b45371fb7a.tar.gz
- [feature] The cast() and extract() constructs
will now be produced via the func.* accessor as well, as users naturally try to access these names from func.* they might as well do what's expected, even though the returned object is not a FunctionElement. [ticket:2562]
Diffstat (limited to 'test/sql/test_functions.py')
-rw-r--r--test/sql/test_functions.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py
index 8e5c6bc58..478f41381 100644
--- a/test/sql/test_functions.py
+++ b/test/sql/test_functions.py
@@ -289,6 +289,12 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
"WHERE users.id BETWEEN c1.z AND c2.z",
checkparams={'y_1': 45, 'x_1': 17, 'y_2': 12, 'x_2': 5})
+ def test_non_functions(self):
+ expr = func.cast("foo", Integer)
+ self.assert_compile(expr, "CAST(:param_1 AS INTEGER)")
+
+ expr = func.extract("year", datetime.date(2010, 12, 5))
+ self.assert_compile(expr, "EXTRACT(year FROM :param_1)")
class ExecuteTest(fixtures.TestBase):
@engines.close_first