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

Method test_in_empty_single

test/sql/test_operators.py:2480–2511  ·  view source on GitHub ↗
(self, is_in, negate)

Source from the content-addressed store, hash-verified

2478 @testing.combinations(True, False, argnames="is_in")
2479 @testing.combinations(True, False, argnames="negate")
2480 def test_in_empty_single(self, is_in, negate):
2481 a = column("a", Integer)
2482
2483 if negate:
2484 expr = ~a.not_in([]) if is_in else ~a.in_([])
2485 else:
2486 expr = a.in_([]) if is_in else a.not_in([])
2487
2488 if is_in:
2489 self.assert_compile(
2490 expr,
2491 "a IN (__[POSTCOMPILE_a_1])",
2492 checkparams={"a_1": []},
2493 )
2494 self.assert_compile(
2495 expr,
2496 "a IN (NULL) AND (1 != 1)",
2497 literal_binds=True,
2498 dialect="default_enhanced",
2499 )
2500 else:
2501 self.assert_compile(
2502 expr,
2503 "(a NOT IN (__[POSTCOMPILE_a_1]))",
2504 checkparams={"a_1": []},
2505 )
2506 self.assert_compile(
2507 expr,
2508 "(a NOT IN (NULL) OR (1 = 1))",
2509 literal_binds=True,
2510 dialect="default_enhanced",
2511 )
2512
2513 def test_in_self_plus_negated(self):
2514 a = column("a", Integer)

Callers

nothing calls this directly

Calls 4

columnFunction · 0.90
assert_compileMethod · 0.80
not_inMethod · 0.45
in_Method · 0.45

Tested by

no test coverage detected