MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_union_ordered

Method test_union_ordered

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

Source from the content-addressed store, hash-verified

1117 eq_(found2, wanted)
1118
1119 def test_union_ordered(self, connection):
1120 t1, t2, t3 = self.tables("t1", "t2", "t3")
1121
1122 s1, s2 = (
1123 select(t1.c.col3.label("col3"), t1.c.col4.label("col4")).where(
1124 t1.c.col2.in_(["t1col2r1", "t1col2r2"]),
1125 ),
1126 select(t2.c.col3.label("col3"), t2.c.col4.label("col4")).where(
1127 t2.c.col2.in_(["t2col2r2", "t2col2r3"]),
1128 ),
1129 )
1130 u = union(s1, s2).order_by("col3", "col4")
1131
1132 wanted = [
1133 ("aaa", "aaa"),
1134 ("bbb", "bbb"),
1135 ("bbb", "ccc"),
1136 ("ccc", "aaa"),
1137 ]
1138 eq_(connection.execute(u).fetchall(), wanted)
1139
1140 @testing.requires.subqueries
1141 def test_union_ordered_alias(self, connection):

Callers

nothing calls this directly

Calls 9

selectFunction · 0.90
unionFunction · 0.90
eq_Function · 0.90
whereMethod · 0.45
labelMethod · 0.45
in_Method · 0.45
order_byMethod · 0.45
fetchallMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected