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

Method test_in_empty_tuple

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

Source from the content-addressed store, hash-verified

2438 @testing.combinations(True, False, argnames="is_in")
2439 @testing.combinations(True, False, argnames="negate")
2440 def test_in_empty_tuple(self, is_in, negate):
2441 a, b, c = (
2442 column("a", Integer),
2443 column("b", String),
2444 column("c", LargeBinary),
2445 )
2446 t1 = tuple_(a, b, c)
2447
2448 if negate:
2449 expr = ~t1.not_in([]) if is_in else ~t1.in_([])
2450 else:
2451 expr = t1.in_([]) if is_in else t1.not_in([])
2452
2453 if is_in:
2454 self.assert_compile(
2455 expr,
2456 "(a, b, c) IN (__[POSTCOMPILE_param_1])",
2457 checkparams={"param_1": []},
2458 )
2459 self.assert_compile(
2460 expr,
2461 "(a, b, c) IN ((NULL, NULL, NULL)) AND (1 != 1)",
2462 literal_binds=True,
2463 dialect="default_enhanced",
2464 )
2465 else:
2466 self.assert_compile(
2467 expr,
2468 "((a, b, c) NOT IN (__[POSTCOMPILE_param_1]))",
2469 checkparams={"param_1": []},
2470 )
2471 self.assert_compile(
2472 expr,
2473 "((a, b, c) NOT IN ((NULL, NULL, NULL)) OR (1 = 1))",
2474 literal_binds=True,
2475 dialect="default_enhanced",
2476 )
2477
2478 @testing.combinations(True, False, argnames="is_in")
2479 @testing.combinations(True, False, argnames="negate")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected