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 | |
| 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
| -rw-r--r-- | test/sql/functions.py | 11 | ||||
| -rw-r--r-- | test/testlib/testing.py | 2 |
2 files changed, 11 insertions, 2 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()") diff --git a/test/testlib/testing.py b/test/testlib/testing.py index 28cc0388c..eda83a55d 100644 --- a/test/testlib/testing.py +++ b/test/testlib/testing.py @@ -695,7 +695,7 @@ class AssertsCompiledSQL(object): cc = re.sub(r'\n', '', str(c)) - self.assertEquals(cc, result) + self.assertEquals(cc, result, "%r != %r on dialect %r" % (cc, result, dialect)) if checkparams is not None: self.assertEquals(c.construct_params(params), checkparams) |
