MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_in_empty_single

Method test_in_empty_single

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

Source from the content-addressed store, hash-verified

2644 @testing.combinations(True, False, argnames="is_in")
2645 @testing.combinations(True, False, argnames="negate")
2646 def test_in_empty_single(self, is_in, negate):
2647 a = column("a", Integer)
2648
2649 if negate:
2650 expr = ~a.not_in([]) if is_in else ~a.in_([])
2651 else:
2652 expr = a.in_([]) if is_in else a.not_in([])
2653
2654 if is_in:
2655 self.assert_compile(
2656 expr,
2657 "a IN (__[POSTCOMPILE_a_1])",
2658 checkparams={"a_1": []},
2659 )
2660 self.assert_compile(
2661 expr,
2662 "a IN (NULL) AND (1 != 1)",
2663 literal_binds=True,
2664 dialect="default_enhanced",
2665 )
2666 else:
2667 self.assert_compile(
2668 expr,
2669 "(a NOT IN (__[POSTCOMPILE_a_1]))",
2670 checkparams={"a_1": []},
2671 )
2672 self.assert_compile(
2673 expr,
2674 "(a NOT IN (NULL) OR (1 = 1))",
2675 literal_binds=True,
2676 dialect="default_enhanced",
2677 )
2678
2679 def test_in_self_plus_negated(self):
2680 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