MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_operators_custom

Method test_operators_custom

test/sql/test_functions.py:111–133  ·  view source on GitHub ↗
(self, op, other, expected, use_custom)

Source from the content-addressed store, hash-verified

109 )
110 @testing.combinations((True,), (False,), argnames="use_custom")
111 def test_operators_custom(self, op, other, expected, use_custom):
112 if use_custom:
113
114 class MyFunc(FunctionElement):
115 inherit_cache = True
116 name = "myfunc"
117 type = Integer()
118
119 @compiles(MyFunc)
120 def visit_myfunc(element, compiler, **kw):
121 return "myfunc(%s)" % compiler.process(element.clauses, **kw)
122
123 expr = op(MyFunc(), other)
124 else:
125 expr = op(func.myfunc(type_=Integer), other)
126
127 self.assert_compile(
128 select(1).where(expr),
129 "SELECT 1 WHERE %s" % (expected,),
130 literal_binds=True,
131 render_postcompile=True,
132 dialect="default_enhanced",
133 )
134
135 def test_use_labels(self):
136 self.assert_compile(

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
opFunction · 0.85
MyFuncClass · 0.85
assert_compileMethod · 0.80
whereMethod · 0.45

Tested by

no test coverage detected