diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-03 09:59:22 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-03 09:59:22 -0400 |
| commit | 1378bf0d25319f3725cfe8ff947a5f0aeae4cc81 (patch) | |
| tree | ded7439311a70858ef11e4b8689fae478f0e7196 /test/sql/test_selectable.py | |
| parent | 47a799ecd5d03b78e5d67918302c0da2950d27b8 (diff) | |
| download | sqlalchemy-1378bf0d25319f3725cfe8ff947a5f0aeae4cc81.tar.gz | |
- reopened #2453, needed to put in the original patch as well to cover the case
of column_property() objs building off each other
Diffstat (limited to 'test/sql/test_selectable.py')
| -rw-r--r-- | test/sql/test_selectable.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 7befa8283..bbb9131a5 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -1136,9 +1136,12 @@ class AnnotationsTest(fixtures.TestBase): def test_annotate_unique_traversal(self): """test that items are copied only once during - annotate, deannotate traversal""" + annotate, deannotate traversal + + #2453 + """ table1 = table('table1', column('x')) - table2 = table('table1', column('y')) + table2 = table('table2', column('y')) a1 = table1.alias() s = select([a1.c.x]).select_from( a1.join(table2, a1.c.x==table2.c.y) @@ -1158,6 +1161,33 @@ class AnnotationsTest(fixtures.TestBase): assert sel._froms[0] is sel._froms[1].left eq_(str(s), str(sel)) + def test_annotate_fromlist_preservation(self): + """test the FROM list in select still works + even when multiple annotate runs have created + copies of the same selectable + + #2453, continued + + """ + table1 = table('table1', column('x')) + table2 = table('table2', column('y')) + a1 = table1.alias() + s = select([a1.c.x]).select_from( + a1.join(table2, a1.c.x==table2.c.y) + ) + + assert_s = select([select([s])]) + for fn in ( + sql_util._deep_deannotate, + lambda s: sql_util._deep_annotate(s, {'foo':'bar'}), + lambda s:visitors.cloned_traverse(s, {}, {}), + lambda s:visitors.replacement_traverse(s, {}, lambda x:None) + ): + + sel = fn(select([fn(select([fn(s)]))])) + eq_(str(assert_s), str(sel)) + + def test_bind_unique_test(self): t1 = table('t', column('a'), column('b')) |
