diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 11:24:23 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 11:24:23 -0400 |
| commit | 9b73e997b2325018555268e1f1069e88e80fdb85 (patch) | |
| tree | 6cd512b1a8395f8dd9edb5915323603ef108db70 /test/sql/test_selectable.py | |
| parent | 3d4c6f68167d33b28e0c3b12032058ad0d807d58 (diff) | |
| download | sqlalchemy-9b73e997b2325018555268e1f1069e88e80fdb85.tar.gz | |
- [bug] The names of the columns on the
.c. attribute of a select().apply_labels()
is now based on <tablename>_<colkey> instead
of <tablename>_<colname>, for those columns
that have a distinctly named .key.
[ticket:2397]
Diffstat (limited to 'test/sql/test_selectable.py')
| -rw-r--r-- | test/sql/test_selectable.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index dde832e7d..e3508f77d 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -100,8 +100,6 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled s = select([keyed]) eq_(s.c.colx.key, 'colx') - # this would change to 'colx' - # with #2397 eq_(s.c.colx.name, 'x') assert s.corresponding_column(keyed.c.colx) is s.c.colx @@ -113,6 +111,17 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled assert sel2.corresponding_column(keyed.c.coly) is sel2.c.coly assert sel2.corresponding_column(keyed.c.z) is sel2.c.z + def test_keyed_label_gen(self): + s = select([keyed]).apply_labels() + + assert s.corresponding_column(keyed.c.colx) is s.c.keyed_colx + assert s.corresponding_column(keyed.c.coly) is s.c.keyed_coly + assert s.corresponding_column(keyed.c.z) is s.c.keyed_z + + sel2 = s.alias() + assert sel2.corresponding_column(keyed.c.colx) is sel2.c.keyed_colx + assert sel2.corresponding_column(keyed.c.coly) is sel2.c.keyed_coly + assert sel2.corresponding_column(keyed.c.z) is sel2.c.keyed_z def test_distance_on_aliases(self): a1 = table1.alias('a1') |
