diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-31 14:30:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-31 14:30:47 -0400 |
commit | d30ab8495c9e16f7cf599da02ac8e333cc620b54 (patch) | |
tree | 1f6cee48de9a8babcdcb6cd5e49ffc5d597a06d8 /test/sql/test_selectable.py | |
parent | f0a9d39634d214672ab5171c7b8178abf2cbea94 (diff) | |
download | sqlalchemy-d30ab8495c9e16f7cf599da02ac8e333cc620b54.tar.gz |
Fixed bug whereby the ".key" of a Column wasn't being
used when producing a "proxy" of the column against
a selectable. This probably didn't occur in 0.7
since 0.7 doesn't respect the ".key" in a wider
range of scenarios. [ticket:2597]
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r-- | test/sql/test_selectable.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 35d5a0b05..53c9018cd 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -125,6 +125,30 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled 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_keyed_c_collection_upper(self): + c = Column('foo', Integer, key='bar') + t = Table('t', MetaData(), c) + is_(t.c.bar, c) + + def test_keyed_c_collection_lower(self): + c = column('foo') + c.key = 'bar' + t = table('t', c) + is_(t.c.bar, c) + + def test_clone_c_proxy_key_upper(self): + c = Column('foo', Integer, key='bar') + t = Table('t', MetaData(), c) + s = select([t])._clone() + assert c in s.c.bar.proxy_set + + def test_clone_c_proxy_key_lower(self): + c = column('foo') + c.key = 'bar' + t = table('t', c) + s = select([t])._clone() + assert c in s.c.bar.proxy_set + def test_distance_on_aliases(self): a1 = table1.alias('a1') for s in (select([a1, table1], use_labels=True), @@ -151,6 +175,7 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled def test_clone_append_column(self): sel = select([literal_column('1').label('a')]) + eq_(sel.c.keys(), ['a']) cloned = visitors.ReplacingCloningVisitor().traverse(sel) cloned.append_column(literal_column('2').label('b')) cloned.append_column(func.foo()) |