MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_compile

Method test_compile

test/sql/test_functions.py:87–116  ·  test/sql/test_functions.py::CompileTest.test_compile
(self)

Source from the content-addressed store, hash-verified

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 == class="st">"psycopg":
91 bindtemplate += class="st">"::VARCHAR"
92 self.assert_compile(
93 func.current_timestamp(), class="st">"CURRENT_TIMESTAMP", dialect=dialect
94 )
95 self.assert_compile(func.localtime(), class="st">"LOCALTIME", dialect=dialect)
96 self.assert_compile(
97 func.nosuchfunction(), class="st">"nosuchfunction()", dialect=dialect
98 )
99
100 class="cm"># 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(class="st">"foo"),
110 class="st">"fake_func(%s)"
111 % bindtemplate
112 % {class="st">"name": class="st">"fake_func_1", class="st">"position": 1},
113 dialect=dialect,
114 )
115
116 functions._registry[class="st">"_default"].pop(class="st">"fake_func")
117
118 @testing.combinations(
119 (operators.in_op, [1, 2, 3], class="st">"myfunc() IN (1, 2, 3)"),

Callers

nothing calls this directly

Calls 6

all_dialectsFunction · 0.90
fake_funcClass · 0.85
assert_compileMethod · 0.80
current_timestampMethod · 0.80
localtimeMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected