summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-01-03 20:57:37 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-01-03 20:57:37 +0000
commitd24133e5c574676bbc0f30c2186d8da25f550ecb (patch)
treec544725ccb5e76b8fbbdcb8f93309ed67817dbfd /test/sql
parenta2c727788e6746b58455c2c4cbd584043b66077d (diff)
downloadsqlalchemy-d24133e5c574676bbc0f30c2186d8da25f550ecb.tar.gz
- Fixed a column arithmetic bug that affected column
correspondence for cloned selectables which contain free-standing column expressions. This bug is generally only noticeable when exercising newer ORM behavior only availble in 0.6 via [ticket:1568], but is more correct at the SQL expression level as well. [ticket:1617]
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_selectable.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 147e47cd9..f5f61aab1 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -57,7 +57,20 @@ class SelectableTest(TestBase, AssertsExecutionResults):
# test alias of the join
j2 = jjj.alias('foo')
assert j2.corresponding_column(table1.c.col1) is j2.c.table1_col1
+
+ def test_against_cloned_non_table(self):
+ # test that corresponding column digs across
+ # clone boundaries with anonymous labeled elements
+ col = func.count().label('foo')
+ sel = select([col])
+
+ sel2 = visitors.ReplacingCloningVisitor().traverse(sel)
+ assert sel2.corresponding_column(col) is sel2.c.foo
+ sel3 = visitors.ReplacingCloningVisitor().traverse(sel2)
+ assert sel3.corresponding_column(col) is sel3.c.foo
+
+
def test_select_on_table(self):
sel = select([table1, table2], use_labels=True)
assert sel.corresponding_column(table1.c.col1) is sel.c.table1_col1