(self)
| 254 | self.assert_compile(stmt, expected_sql, dialect=dialect) |
| 255 | |
| 256 | def test_cube_operators(self): |
| 257 | t = table( |
| 258 | "t", |
| 259 | column("value"), |
| 260 | column("x"), |
| 261 | column("y"), |
| 262 | column("z"), |
| 263 | column("q"), |
| 264 | ) |
| 265 | |
| 266 | stmt = select(func.sum(t.c.value)) |
| 267 | |
| 268 | self.assert_compile( |
| 269 | stmt.group_by(func.cube(t.c.x, t.c.y)), |
| 270 | "SELECT sum(t.value) AS sum_1 FROM t GROUP BY CUBE(t.x, t.y)", |
| 271 | ) |
| 272 | |
| 273 | self.assert_compile( |
| 274 | stmt.group_by(func.rollup(t.c.x, t.c.y)), |
| 275 | "SELECT sum(t.value) AS sum_1 FROM t GROUP BY ROLLUP(t.x, t.y)", |
| 276 | ) |
| 277 | |
| 278 | self.assert_compile( |
| 279 | stmt.group_by(func.grouping_sets(t.c.x, t.c.y)), |
| 280 | "SELECT sum(t.value) AS sum_1 FROM t " |
| 281 | "GROUP BY GROUPING SETS(t.x, t.y)", |
| 282 | ) |
| 283 | |
| 284 | self.assert_compile( |
| 285 | stmt.group_by( |
| 286 | func.grouping_sets( |
| 287 | sql.tuple_(t.c.x, t.c.y), sql.tuple_(t.c.z, t.c.q) |
| 288 | ) |
| 289 | ), |
| 290 | "SELECT sum(t.value) AS sum_1 FROM t GROUP BY " |
| 291 | "GROUPING SETS((t.x, t.y), (t.z, t.q))", |
| 292 | ) |
| 293 | |
| 294 | def test_generic_annotation(self): |
| 295 | fn = func.coalesce("x", "y")._annotate({"foo": "bar"}) |
nothing calls this directly
no test coverage detected