| 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") |