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

Method test_union_ordered_alias

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

Source from the content-addressed store, hash-verified

1207
1208 @testing.requires.subqueries
1209 def test_union_ordered_alias(self, connection):
1210 t1, t2, t3 = self.tables("t1", "t2", "t3")
1211
1212 s1, s2 = (
1213 select(t1.c.col3.label("col3"), t1.c.col4.label("col4")).where(
1214 t1.c.col2.in_(["t1col2r1", "t1col2r2"]),
1215 ),
1216 select(t2.c.col3.label("col3"), t2.c.col4.label("col4")).where(
1217 t2.c.col2.in_(["t2col2r2", "t2col2r3"]),
1218 ),
1219 )
1220 u = union(s1, s2).order_by("col3", "col4")
1221
1222 wanted = [
1223 ("aaa", "aaa"),
1224 ("bbb", "bbb"),
1225 ("bbb", "ccc"),
1226 ("ccc", "aaa"),
1227 ]
1228 eq_(connection.execute(u.alias("bar").select()).fetchall(), wanted)
1229
1230 @testing.crashes("oracle", "FIXME: unknown, verify not fails_on")
1231 @testing.fails_on(

Callers

nothing calls this directly

Calls 11

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
selectMethod · 0.45
aliasMethod · 0.45

Tested by

no test coverage detected