(self)
| 3421 | self.assert_compile(sel3, "(SELECT foo)") |
| 3422 | |
| 3423 | def test_naming(self): |
| 3424 | # TODO: the part where we check c.keys() are not "compile" tests, they |
| 3425 | # belong probably in test_selectable, or some broken up |
| 3426 | # version of that suite |
| 3427 | |
| 3428 | f1 = func.hoho(table1.c.name) |
| 3429 | s1 = select( |
| 3430 | table1.c.myid, |
| 3431 | table1.c.myid.label("foobar"), |
| 3432 | f1, |
| 3433 | func.lala(table1.c.name).label("gg"), |
| 3434 | ) |
| 3435 | |
| 3436 | eq_(list(s1.subquery().c.keys()), ["myid", "foobar", "hoho", "gg"]) |
| 3437 | |
| 3438 | meta = MetaData() |
| 3439 | t1 = Table("mytable", meta, Column("col1", Integer)) |
| 3440 | |
| 3441 | exprs = ( |
| 3442 | table1.c.myid == 12, |
| 3443 | func.hoho(table1.c.myid), |
| 3444 | cast(table1.c.name, Numeric), |
| 3445 | literal("x"), |
| 3446 | ) |
| 3447 | for col, key, expr, lbl in ( |
| 3448 | (table1.c.name, "name", "mytable.name", None), |
| 3449 | ( |
| 3450 | exprs[0], |
| 3451 | "_no_label", |
| 3452 | "mytable.myid = :myid_1", |
| 3453 | "anon_1", |
| 3454 | ), |
| 3455 | (exprs[1], "hoho", "hoho(mytable.myid)", "hoho_1"), |
| 3456 | ( |
| 3457 | exprs[2], |
| 3458 | "name", |
| 3459 | "CAST(mytable.name AS NUMERIC)", |
| 3460 | "name", # due to [ticket:4449] |
| 3461 | ), |
| 3462 | (t1.c.col1, "col1", "mytable.col1", None), |
| 3463 | ( |
| 3464 | column("some wacky thing"), |
| 3465 | "some wacky thing", |
| 3466 | '"some wacky thing"', |
| 3467 | "", |
| 3468 | ), |
| 3469 | ( |
| 3470 | exprs[3], |
| 3471 | "_no_label", |
| 3472 | ":param_1", |
| 3473 | "anon_1", |
| 3474 | ), |
| 3475 | ): |
| 3476 | if getattr(col, "table", None) is not None: |
| 3477 | t = col.table |
| 3478 | else: |
| 3479 | t = table1 |
| 3480 |
nothing calls this directly
no test coverage detected