(self)
| 85 | functions._registry = self._registry |
| 86 | |
| 87 | def test_compile(self): |
| 88 | for dialect in all_dialects(): |
| 89 | bindtemplate = BIND_TEMPLATES[dialect.paramstyle] |
| 90 | if dialect.driver == "psycopg": |
| 91 | bindtemplate += "::VARCHAR" |
| 92 | self.assert_compile( |
| 93 | func.current_timestamp(), "CURRENT_TIMESTAMP", dialect=dialect |
| 94 | ) |
| 95 | self.assert_compile(func.localtime(), "LOCALTIME", dialect=dialect) |
| 96 | self.assert_compile( |
| 97 | func.nosuchfunction(), "nosuchfunction()", dialect=dialect |
| 98 | ) |
| 99 | |
| 100 | # test generic function compile |
| 101 | class fake_func(GenericFunction): |
| 102 | inherit_cache = True |
| 103 | __return_type__ = sqltypes.Integer |
| 104 | |
| 105 | def __init__(self, arg, **kwargs): |
| 106 | GenericFunction.__init__(self, arg, **kwargs) |
| 107 | |
| 108 | self.assert_compile( |
| 109 | fake_func("foo"), |
| 110 | "fake_func(%s)" |
| 111 | % bindtemplate |
| 112 | % {"name": "fake_func_1", "position": 1}, |
| 113 | dialect=dialect, |
| 114 | ) |
| 115 | |
| 116 | functions._registry["_default"].pop("fake_func") |
| 117 | |
| 118 | @testing.combinations( |
| 119 | (operators.in_op, [1, 2, 3], "myfunc() IN (1, 2, 3)"), |
nothing calls this directly
no test coverage detected