summaryrefslogtreecommitdiff
path: root/test/orm/test_query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-23 17:03:48 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-23 17:03:48 -0500
commitae4629e6a0ff442a819b80f418dee76c25c50938 (patch)
treec2fccb7619c5ee3bf2a2433f489b54b8ebf2d251 /test/orm/test_query.py
parent6b79d2ea7951abc2bb6083b541db0fbf71590dd3 (diff)
downloadsqlalchemy-ae4629e6a0ff442a819b80f418dee76c25c50938.tar.gz
- Some refinements to the :class:`.AliasedClass` construct with regards
to descriptors, like hybrids, synonyms, composites, user-defined descriptors, etc. The attribute adaptation which goes on has been made more robust, such that if a descriptor returns another instrumented attribute, rather than a compound SQL expression element, the operation will still proceed. Addtionally, the "adapted" operator will retain its class; previously, a change in class from ``InstrumentedAttribute`` to ``QueryableAttribute`` (a superclass) would interact with Python's operator system such that an expression like ``aliased(MyClass.x) > MyClass.x`` would reverse itself to read ``myclass.x < myclass_1.x``. The adapted attribute will also refer to the new :class:`.AliasedClass` as its parent which was not always the case before. [ticket:2872]
Diffstat (limited to 'test/orm/test_query.py')
-rw-r--r--test/orm/test_query.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/orm/test_query.py b/test/orm/test_query.py
index 619836ae4..1b6c1fc3a 100644
--- a/test/orm/test_query.py
+++ b/test/orm/test_query.py
@@ -227,10 +227,13 @@ class RawSelectTest(QueryTest, AssertsCompiledSQL):
where(uu.id == Address.user_id).\
correlate(uu).as_scalar()
]),
- # curious, "address.user_id = uu.id" is reversed here
+ # for a long time, "uu.id = address.user_id" was reversed;
+ # this was resolved as of #2872 and had to do with
+ # InstrumentedAttribute.__eq__() taking precedence over
+ # QueryableAttribute.__eq__()
"SELECT uu.name, addresses.id, "
"(SELECT count(addresses.id) AS count_1 "
- "FROM addresses WHERE addresses.user_id = uu.id) AS anon_1 "
+ "FROM addresses WHERE uu.id = addresses.user_id) AS anon_1 "
"FROM users AS uu, addresses"
)
@@ -1986,7 +1989,7 @@ class HintsTest(QueryTest, AssertsCompiledSQL):
"SELECT users.id AS users_id, users.name AS users_name, "
"users_1.id AS users_1_id, users_1.name AS users_1_name "
"FROM users INNER JOIN users AS users_1 USE INDEX (col1_index,col2_index) "
- "ON users.id < users_1.id",
+ "ON users_1.id > users.id",
dialect=dialect
)