MCPcopy Index your code
hub / github.com/zzzeek/sqlalchemy / test_parenthesized_exprs

Method test_parenthesized_exprs

test/sql/test_operators.py:411–434  ·  view source on GitHub ↗
(self, op, reverse, negate)

Source from the content-addressed store, hash-verified

409 @testing.combinations(True, False, argnames="reverse")
410 @testing.combinations(True, False, argnames="negate")
411 def test_parenthesized_exprs(self, op, reverse, negate):
412 t1 = table("t", column("q"), column("p"))
413
414 inner = lambda: t1.c.q - t1.c.p # noqa E371
415 expr = op(inner(), inner())
416
417 if reverse:
418 for i in range(8):
419 expr = op(inner(), expr)
420 else:
421 for i in range(8):
422 expr = op(expr, inner())
423
424 opstring = compiler.OPERATORS[op]
425 exprs = opstring.join("(t.q - t.p)" for i in range(10))
426
427 if negate:
428 self.assert_compile(
429 select(~expr), f"SELECT NOT ({exprs}) AS anon_1 FROM t"
430 )
431 else:
432 self.assert_compile(
433 select(expr), f"SELECT {exprs} AS anon_1 FROM t"
434 )
435
436 @testing.combinations(
437 (

Callers

nothing calls this directly

Calls 6

tableFunction · 0.90
columnFunction · 0.90
opFunction · 0.85
selectFunction · 0.85
assert_compileMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected