From bf67069d264cba3feed8a48614289d605ed61a55 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 26 Feb 2014 13:28:14 -0500 Subject: - Fixed issue in new :meth:`.TextClause.columns` method where the ordering of columns given positionally would not be preserved. This could have potential impact in positional situations such as applying the resulting :class:`.TextAsFrom` object to a union. --- test/sql/test_selectable.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/sql/test_selectable.py') diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index dbd73a836..9617cfdf7 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -388,6 +388,31 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled assert u.corresponding_column(s2.c.table2_coly) is u.c.coly assert s2.corresponding_column(u.c.coly) is s2.c.table2_coly + def test_union_of_alias(self): + s1 = select([table1.c.col1, table1.c.col2]) + s2 = select([table1.c.col1, table1.c.col2]).alias() + + u1 = union(s1, s2) + assert u1.corresponding_column(s1.c.col1) is u1.c.col1 + assert u1.corresponding_column(s2.c.col1) is u1.c.col1 + + u2 = union(s2, s1) + assert u2.corresponding_column(s1.c.col1) is u2.c.col1 + assert u2.corresponding_column(s2.c.col1) is u2.c.col1 + + def test_union_of_text(self): + s1 = select([table1.c.col1, table1.c.col2]) + s2 = text("select col1, col2 from foo").columns( + column('col1'), column('col2')) + + u1 = union(s1, s2) + assert u1.corresponding_column(s1.c.col1) is u1.c.col1 + assert u1.corresponding_column(s2.c.col1) is u1.c.col1 + + u2 = union(s2, s1) + assert u2.corresponding_column(s1.c.col1) is u2.c.col1 + assert u2.corresponding_column(s2.c.col1) is u2.c.col1 + def test_select_union(self): # like testaliasunion, but off a Select off the union. -- cgit v1.2.1