diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-19 22:46:14 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-19 22:46:14 +0000 |
commit | b3102a097a3ef95430a8bad65b3f171c45dd6cc2 (patch) | |
tree | 8c43f679d71a5f8680a84e40ddd3a1637aadf613 /test/sql/functions.py | |
parent | ad23f3b068554aaf21d71b6f288ec0cf3fe81696 (diff) | |
download | sqlalchemy-b3102a097a3ef95430a8bad65b3f171c45dd6cc2.tar.gz |
- changed char_length() to use a fake, neutral "generic function"
- assert_compile() reports the dialect in use
Diffstat (limited to 'test/sql/functions.py')
-rw-r--r-- | test/sql/functions.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/sql/functions.py b/test/sql/functions.py index 82814ef1b..6754d6d42 100644 --- a/test/sql/functions.py +++ b/test/sql/functions.py @@ -7,6 +7,7 @@ from sqlalchemy.sql.compiler import BIND_TEMPLATES from sqlalchemy.engine import default from sqlalchemy import types as sqltypes from testlib import * +from sqlalchemy.sql.functions import GenericFunction from sqlalchemy.databases import * # every dialect in databases.__all__ is expected to pass these tests. @@ -31,7 +32,15 @@ class CompileTest(TestBase, AssertsCompiledSQL): self.assert_compile(func.nosuchfunction(), "nosuchfunction", dialect=dialect) else: self.assert_compile(func.nosuchfunction(), "nosuchfunction()", dialect=dialect) - self.assert_compile(func.char_length('foo'), "char_length(%s)" % bindtemplate % {'name':'param_1', 'position':1}, dialect=dialect) + + # test generic function compile + class fake_func(GenericFunction): + __return_type__ = sqltypes.Integer + + def __init__(self, arg, **kwargs): + GenericFunction.__init__(self, args=[arg], **kwargs) + + self.assert_compile(fake_func('foo'), "fake_func(%s)" % bindtemplate % {'name':'param_1', 'position':1}, dialect=dialect) def test_underscores(self): self.assert_compile(func.if_(), "if()") |