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

Method test_except_style2

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

Source from the content-addressed store, hash-verified

1318
1319 @testing.requires.except_
1320 def test_except_style2(self, connection):
1321 # same as style1, but add alias().select() to the except_().
1322 # sqlite can handle it now.
1323
1324 t1, t2, t3 = self.tables("t1", "t2", "t3")
1325
1326 e = except_(
1327 union(
1328 select(t1.c.col3, t1.c.col4),
1329 select(t2.c.col3, t2.c.col4),
1330 select(t3.c.col3, t3.c.col4),
1331 )
1332 .alias()
1333 .select(),
1334 select(t2.c.col3, t2.c.col4),
1335 )
1336
1337 wanted = [
1338 ("aaa", "aaa"),
1339 ("aaa", "ccc"),
1340 ("bbb", "aaa"),
1341 ("bbb", "bbb"),
1342 ("ccc", "bbb"),
1343 ("ccc", "ccc"),
1344 ]
1345
1346 found1 = self._fetchall_sorted(connection.execute(e))
1347 eq_(found1, wanted)
1348
1349 found2 = self._fetchall_sorted(connection.execute(e.alias().select()))
1350 eq_(found2, wanted)
1351
1352 @testing.fails_on(
1353 ["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