diff options
Diffstat (limited to 'test/sql/test_selectable.py')
| -rw-r--r-- | test/sql/test_selectable.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index ff569288e..f41360359 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -154,6 +154,33 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled cloned.append_column(func.foo()) eq_(cloned.c.keys(), ['a', 'b', 'foo()']) + def test_append_column_after_replace_selectable(self): + basesel = select([literal_column('1').label('a')]) + tojoin = select([ + literal_column('1').label('a'), + literal_column('2').label('b') + ]) + basefrom = basesel.alias('basefrom') + joinfrom = tojoin.alias('joinfrom') + sel = select([basefrom.c.a]) + replaced = sel.replace_selectable( + basefrom, + basefrom.join(joinfrom, basefrom.c.a == joinfrom.c.a) + ) + self.assert_compile( + replaced, + "SELECT basefrom.a FROM (SELECT 1 AS a) AS basefrom " + "JOIN (SELECT 1 AS a, 2 AS b) AS joinfrom " + "ON basefrom.a = joinfrom.a" + ) + replaced.append_column(joinfrom.c.b) + self.assert_compile( + replaced, + "SELECT basefrom.a, joinfrom.b FROM (SELECT 1 AS a) AS basefrom " + "JOIN (SELECT 1 AS a, 2 AS b) AS joinfrom " + "ON basefrom.a = joinfrom.a" + ) + def test_against_cloned_non_table(self): # test that corresponding column digs across # clone boundaries with anonymous labeled elements |
