summaryrefslogtreecommitdiff
path: root/test/sql/test_selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-07-24 17:51:01 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-07-24 17:51:01 -0400
commit8a483dbf38168ff43ca0652229b1d46afb23235d (patch)
tree0707d1e1f3912bda8262e32bd1e4e008a7c67b88 /test/sql/test_selectable.py
parent9867086943d60e347695930dd7f442f9e95e4577 (diff)
downloadsqlalchemy-8a483dbf38168ff43ca0652229b1d46afb23235d.tar.gz
- rewrite cloned_traverse() and replacement_traverse() to use a straight
recursive descent with clone() + _copy_internals(). This is essentially what it was doing anyway with lots of unnecessary steps. Fix Alias() to honor the given clone() function which may have been the reason the traversal hadn't been fixed sooner. Alias._copy_internals() will specifically skip an alias of a Table as a more specific form of what it was doing before. This may need to be further improved such that ClauseAdapter or replacement_traverse() send it some specific hints what not to dig into; **kw has been added to all _copy_internals() to support this. replacement/clone traversal is at least clear now. - apply new no_replacement_traverse annotation to join created by _create_joins(), fixes [ticket:2195] - can replace orm.query "_halt_adapt" with "no_replacement_traverse"
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r--test/sql/test_selectable.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 63be50a97..555271f16 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -914,6 +914,13 @@ class AnnotationsTest(fixtures.TestBase):
b5 = visitors.cloned_traverse(b3, {}, {'binary':visit_binary})
assert str(b5) == ":bar = table1.col2"
+ def test_annotate_aliased(self):
+ t1 = table('t1', column('c1'))
+ s = select([(t1.c.c1 + 3).label('bat')])
+ a = s.alias()
+ a = sql_util._deep_annotate(a, {'foo': 'bar'})
+ eq_(a._annotations['foo'], 'bar')
+ eq_(a.element._annotations['foo'], 'bar')
def test_annotate_expressions(self):
table1 = table('table1', column('col1'), column('col2'))