| 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 | ( |