def test_compile(self): for dialect in all_dialects(exclude=("sybase", )): bindtemplate = BIND_TEMPLATES[dialect.paramstyle] self.assert_compile(func.current_timestamp(), "CURRENT_TIMESTAMP", dialect=dialect) self.assert_compile(func.localtime(), "LOCALTIME", dialect=dialect) if dialect.name in ("firebird", ): self.assert_compile(func.nosuchfunction(), "nosuchfunction", dialect=dialect) else: self.assert_compile(func.nosuchfunction(), "nosuchfunction()", dialect=dialect) # test generic function compile class fake_func(GenericFunction): __return_type__ = sqltypes.Integer def __init__(self, arg, **kwargs): GenericFunction.__init__(self, arg, **kwargs) self.assert_compile( fake_func("foo"), "fake_func(%s)" % bindtemplate % { "name": "fake_func_1", "position": 1 }, dialect=dialect, ) functions._registry["_default"].pop("fake_func")
def test_compile(self): for dialect in all_dialects(exclude=('sybase', )): bindtemplate = BIND_TEMPLATES[dialect.paramstyle] self.assert_compile(func.current_timestamp(), "CURRENT_TIMESTAMP", dialect=dialect) self.assert_compile(func.localtime(), "LOCALTIME", dialect=dialect) if dialect.name in ('firebird',): self.assert_compile(func.nosuchfunction(), "nosuchfunction", dialect=dialect) else: self.assert_compile(func.nosuchfunction(), "nosuchfunction()", dialect=dialect) # test generic function compile class fake_func(GenericFunction): __return_type__ = sqltypes.Integer def __init__(self, arg, **kwargs): GenericFunction.__init__(self, arg, **kwargs) self.assert_compile( fake_func('foo'), "fake_func(%s)" % bindtemplate % {'name': 'fake_func_1', 'position': 1}, dialect=dialect)
def test_compile(self): for dialect in all_dialects(exclude=("sybase",)): bindtemplate = BIND_TEMPLATES[dialect.paramstyle] self.assert_compile( func.current_timestamp(), "CURRENT_TIMESTAMP", dialect=dialect ) self.assert_compile(func.localtime(), "LOCALTIME", dialect=dialect) if dialect.name in ("firebird",): self.assert_compile( func.nosuchfunction(), "nosuchfunction", dialect=dialect ) else: self.assert_compile( func.nosuchfunction(), "nosuchfunction()", dialect=dialect ) # test generic function compile class fake_func(GenericFunction): __return_type__ = sqltypes.Integer def __init__(self, arg, **kwargs): GenericFunction.__init__(self, arg, **kwargs) self.assert_compile( fake_func("foo"), "fake_func(%s)" % bindtemplate % {"name": "fake_func_1", "position": 1}, dialect=dialect, ) functions._registry['_default'].pop('fake_func')