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

Method test_operate

test/sql/test_operators.py:144–179  ·  view source on GitHub ↗
(self, operator, right)

Source from the content-addressed store, hash-verified

142 id_="ns",
143 )
144 def test_operate(self, operator, right):
145 left = column("left")
146
147 if operators.is_comparison(operator):
148 type_ = sqltypes.BOOLEANTYPE
149 else:
150 type_ = sqltypes.NULLTYPE
151
152 assert left.comparator.operate(operator, right).compare(
153 BinaryExpression(
154 coercions.expect(roles.WhereHavingRole, left),
155 coercions.expect(roles.WhereHavingRole, right),
156 operator,
157 type_=type_,
158 )
159 )
160
161 modifiers = operator(left, right).modifiers
162
163 assert operator(left, right).compare(
164 BinaryExpression(
165 coercions.expect(roles.WhereHavingRole, left),
166 coercions.expect(roles.WhereHavingRole, right),
167 operator,
168 modifiers=modifiers,
169 type_=type_,
170 )
171 )
172
173 self._loop_test(operator, right)
174
175 if operators.is_comparison(operator):
176 is_(
177 left.comparator.operate(operator, right).type,
178 sqltypes.BOOLEANTYPE,
179 )
180
181 def _loop_test(self, operator, *arg):
182 loop = LoopOperate()

Callers

nothing calls this directly

Calls 7

_loop_testMethod · 0.95
columnFunction · 0.90
is_Function · 0.90
BinaryExpressionClass · 0.85
is_comparisonMethod · 0.80
compareMethod · 0.45
operateMethod · 0.45

Tested by

no test coverage detected