MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_union_ordered_alias

Method test_union_ordered_alias

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

Source from the content-addressed store, hash-verified

1139
1140 @testing.requires.subqueries
1141 def test_union_ordered_alias(self, connection):
1142 t1, t2, t3 = self.tables("t1", "t2", "t3")
1143
1144 s1, s2 = (
1145 select(t1.c.col3.label("col3"), t1.c.col4.label("col4")).where(
1146 t1.c.col2.in_(["t1col2r1", "t1col2r2"]),
1147 ),
1148 select(t2.c.col3.label("col3"), t2.c.col4.label("col4")).where(
1149 t2.c.col2.in_(["t2col2r2", "t2col2r3"]),
1150 ),
1151 )
1152 u = union(s1, s2).order_by("col3", "col4")
1153
1154 wanted = [
1155 ("aaa", "aaa"),
1156 ("bbb", "bbb"),
1157 ("bbb", "ccc"),
1158 ("ccc", "aaa"),
1159 ]
1160 eq_(connection.execute(u.alias("bar").select()).fetchall(), wanted)
1161
1162 @testing.crashes("oracle", "FIXME: unknown, verify not fails_on")
1163 @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