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

Method test_intersect

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

Source from the content-addressed store, hash-verified

1273
1274 @testing.requires.intersect
1275 def test_intersect(self, connection):
1276 t1, t2, t3 = self.tables("t1", "t2", "t3")
1277
1278 i = intersect(
1279 select(t2.c.col3, t2.c.col4),
1280 select(t2.c.col3, t2.c.col4).where(t2.c.col4 == t3.c.col3),
1281 )
1282
1283 wanted = [("aaa", "bbb"), ("bbb", "ccc"), ("ccc", "aaa")]
1284
1285 found1 = self._fetchall_sorted(connection.execute(i))
1286 eq_(found1, wanted)
1287
1288 found2 = self._fetchall_sorted(
1289 connection.execute(i.alias("bar").select())
1290 )
1291 eq_(found2, wanted)
1292
1293 @testing.requires.except_
1294 @testing.fails_on("sqlite", "Can't handle this style of nesting")

Callers

nothing calls this directly

Calls 8

_fetchall_sortedMethod · 0.95
intersectFunction · 0.90
selectFunction · 0.90
eq_Function · 0.90
whereMethod · 0.45
executeMethod · 0.45
selectMethod · 0.45
aliasMethod · 0.45

Tested by

no test coverage detected