(self, op, other, expected, use_custom)
| 123 | ) |
| 124 | @testing.combinations((True,), (False,), argnames="use_custom") |
| 125 | def test_operators_custom(self, op, other, expected, use_custom): |
| 126 | if use_custom: |
| 127 | |
| 128 | class MyFunc(FunctionElement): |
| 129 | inherit_cache = True |
| 130 | name = "myfunc" |
| 131 | type = Integer() |
| 132 | |
| 133 | @compiles(MyFunc) |
| 134 | def visit_myfunc(element, compiler, **kw): |
| 135 | return "myfunc(%s)" % compiler.process(element.clauses, **kw) |
| 136 | |
| 137 | expr = op(MyFunc(), other) |
| 138 | else: |
| 139 | expr = op(func.myfunc(type_=Integer), other) |
| 140 | |
| 141 | self.assert_compile( |
| 142 | select(1).where(expr), |
| 143 | "SELECT 1 WHERE %s" % (expected,), |
| 144 | literal_binds=True, |
| 145 | render_postcompile=True, |
| 146 | dialect="default_enhanced", |
| 147 | ) |
| 148 | |
| 149 | def test_use_labels(self): |
| 150 | self.assert_compile( |
nothing calls this directly
no test coverage detected