MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_expanding_in_repeated

Method test_expanding_in_repeated

test/sql/test_query.py:681–720  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

679 )
680
681 def test_expanding_in_repeated(self, connection):
682 users = self.tables.users
683
684 connection.execute(
685 users.insert(),
686 [
687 dict(user_id=7, user_name="jack"),
688 dict(user_id=8, user_name="fred"),
689 dict(user_id=9, user_name="ed"),
690 ],
691 )
692
693 stmt = (
694 select(users)
695 .where(
696 users.c.user_name.in_(bindparam("uname", expanding=True))
697 | users.c.user_name.in_(bindparam("uname2", expanding=True))
698 )
699 .where(users.c.user_id == 8)
700 )
701 stmt = stmt.union(
702 select(users)
703 .where(
704 users.c.user_name.in_(bindparam("uname", expanding=True))
705 | users.c.user_name.in_(bindparam("uname2", expanding=True))
706 )
707 .where(users.c.user_id == 9)
708 ).order_by("user_id")
709
710 eq_(
711 connection.execute(
712 stmt,
713 {
714 "uname": ["jack", "fred"],
715 "uname2": ["ed"],
716 "userid": [8, 9],
717 },
718 ).fetchall(),
719 [(8, "fred"), (9, "ed")],
720 )
721
722 @testing.requires.tuple_in
723 def test_expanding_in_composite(self, connection):

Callers

nothing calls this directly

Calls 10

selectFunction · 0.90
bindparamFunction · 0.90
eq_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
whereMethod · 0.45
in_Method · 0.45
order_byMethod · 0.45
unionMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected