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