MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_in_empty_tuple

Method test_in_empty_tuple

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

Source from the content-addressed store, hash-verified

2604 @testing.combinations(True, False, argnames="is_in")
2605 @testing.combinations(True, False, argnames="negate")
2606 def test_in_empty_tuple(self, is_in, negate):
2607 a, b, c = (
2608 column("a", Integer),
2609 column("b", String),
2610 column("c", LargeBinary),
2611 )
2612 t1 = tuple_(a, b, c)
2613
2614 if negate:
2615 expr = ~t1.not_in([]) if is_in else ~t1.in_([])
2616 else:
2617 expr = t1.in_([]) if is_in else t1.not_in([])
2618
2619 if is_in:
2620 self.assert_compile(
2621 expr,
2622 "(a, b, c) IN (__[POSTCOMPILE_param_1])",
2623 checkparams={"param_1": []},
2624 )
2625 self.assert_compile(
2626 expr,
2627 "(a, b, c) IN ((NULL, NULL, NULL)) AND (1 != 1)",
2628 literal_binds=True,
2629 dialect="default_enhanced",
2630 )
2631 else:
2632 self.assert_compile(
2633 expr,
2634 "((a, b, c) NOT IN (__[POSTCOMPILE_param_1]))",
2635 checkparams={"param_1": []},
2636 )
2637 self.assert_compile(
2638 expr,
2639 "((a, b, c) NOT IN ((NULL, NULL, NULL)) OR (1 = 1))",
2640 literal_binds=True,
2641 dialect="default_enhanced",
2642 )
2643
2644 @testing.combinations(True, False, argnames="is_in")
2645 @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