summaryrefslogtreecommitdiff
path: root/test/sql/test_selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-06-27 18:54:02 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-06-27 18:54:02 -0400
commit63dbed1fd7421fd4f5cbf0bb2773f7faa8359651 (patch)
treed1a800dba12d888dac2fbb063193131f06d9e684 /test/sql/test_selectable.py
parent1006f1705169310477db073c2b66af1d20615c38 (diff)
downloadsqlalchemy-63dbed1fd7421fd4f5cbf0bb2773f7faa8359651.tar.gz
- Fixed a subtle bug involving column
correspondence in a selectable with the same column repeated. Affects [ticket:2188].
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r--test/sql/test_selectable.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index ef87a68b9..debdd0bb7 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -47,6 +47,24 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled
assert s.corresponding_column(s.c.col1) is s.c.col1
assert s.corresponding_column(s.c.c1) is s.c.c1
+ def test_labeled_subquery_twice(self):
+ scalar_select = select([table1.c.col1]).label('foo')
+
+ s1 = select([scalar_select])
+ s2 = select([scalar_select, scalar_select])
+
+ eq_(
+ s1.c.foo.proxy_set,
+ set([s1.c.foo, scalar_select, scalar_select.element, table1.c.col1])
+ )
+ eq_(
+ s2.c.foo.proxy_set,
+ set([s2.c.foo, scalar_select, scalar_select.element, table1.c.col1])
+ )
+
+ assert s1.corresponding_column(scalar_select) is s1.c.foo
+ assert s2.corresponding_column(scalar_select) is s2.c.foo
+
def test_direct_correspondence_on_labels(self):
# this test depends on labels being part
# of the proxy set to get the right result