(self)
| 647 | assert s.corresponding_column(a1.c.col1) is s.c.a1_col1 |
| 648 | |
| 649 | def test_join_against_self(self): |
| 650 | jj = select(table1.c.col1.label("bar_col1")).subquery() |
| 651 | jjj = join(table1, jj, table1.c.col1 == jj.c.bar_col1) |
| 652 | |
| 653 | # test column directly against itself |
| 654 | |
| 655 | # joins necessarily have to prefix column names with the name |
| 656 | # of the selectable, else the same-named columns will overwrite |
| 657 | # one another. In this case, we unfortunately have this |
| 658 | # unfriendly "anonymous" name, whereas before when select() could |
| 659 | # be a FROM the "bar_col1" label would be directly in the join() |
| 660 | # object. However this was a useless join() object because PG and |
| 661 | # MySQL don't accept unnamed subqueries in joins in any case. |
| 662 | name = "%s_bar_col1" % (jj.name,) |
| 663 | |
| 664 | assert jjj.corresponding_column(jjj.c.table1_col1) is jjj.c.table1_col1 |
| 665 | assert jjj.corresponding_column(jj.c.bar_col1) is jjj.c[name] |
| 666 | |
| 667 | # test alias of the join |
| 668 | |
| 669 | j2 = ( |
| 670 | jjj.select() |
| 671 | .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL) |
| 672 | .subquery("foo") |
| 673 | ) |
| 674 | assert j2.corresponding_column(table1.c.col1) is j2.c.table1_col1 |
| 675 | |
| 676 | def test_clone_append_column(self): |
| 677 | sel = select(literal_column("1").label("a")) |
nothing calls this directly
no test coverage detected