MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_intersect

Method test_intersect

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

Source from the content-addressed store, hash-verified

1205
1206 @testing.requires.intersect
1207 def test_intersect(self, connection):
1208 t1, t2, t3 = self.tables("t1", "t2", "t3")
1209
1210 i = intersect(
1211 select(t2.c.col3, t2.c.col4),
1212 select(t2.c.col3, t2.c.col4).where(t2.c.col4 == t3.c.col3),
1213 )
1214
1215 wanted = [("aaa", "bbb"), ("bbb", "ccc"), ("ccc", "aaa")]
1216
1217 found1 = self._fetchall_sorted(connection.execute(i))
1218 eq_(found1, wanted)
1219
1220 found2 = self._fetchall_sorted(
1221 connection.execute(i.alias("bar").select())
1222 )
1223 eq_(found2, wanted)
1224
1225 @testing.requires.except_
1226 @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