MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_except_style2

Method test_except_style2

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

Source from the content-addressed store, hash-verified

1250
1251 @testing.requires.except_
1252 def test_except_style2(self, connection):
1253 # same as style1, but add alias().select() to the except_().
1254 # sqlite can handle it now.
1255
1256 t1, t2, t3 = self.tables("t1", "t2", "t3")
1257
1258 e = except_(
1259 union(
1260 select(t1.c.col3, t1.c.col4),
1261 select(t2.c.col3, t2.c.col4),
1262 select(t3.c.col3, t3.c.col4),
1263 )
1264 .alias()
1265 .select(),
1266 select(t2.c.col3, t2.c.col4),
1267 )
1268
1269 wanted = [
1270 ("aaa", "aaa"),
1271 ("aaa", "ccc"),
1272 ("bbb", "aaa"),
1273 ("bbb", "bbb"),
1274 ("ccc", "bbb"),
1275 ("ccc", "ccc"),
1276 ]
1277
1278 found1 = self._fetchall_sorted(connection.execute(e))
1279 eq_(found1, wanted)
1280
1281 found2 = self._fetchall_sorted(connection.execute(e.alias().select()))
1282 eq_(found2, wanted)
1283
1284 @testing.fails_on(
1285 ["sqlite", testing.requires._mysql_not_mariadb_104_not_mysql8031],

Callers

nothing calls this directly

Calls 8

_fetchall_sortedMethod · 0.95
except_Function · 0.90
unionFunction · 0.90
selectFunction · 0.90
eq_Function · 0.90
selectMethod · 0.45
aliasMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected