From 9b73e997b2325018555268e1f1069e88e80fdb85 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 24 Apr 2012 11:24:23 -0400 Subject: - [bug] The names of the columns on the .c. attribute of a select().apply_labels() is now based on _ instead of _, for those columns that have a distinctly named .key. [ticket:2397] --- test/sql/test_selectable.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test/sql/test_selectable.py') 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') -- cgit v1.2.1