summaryrefslogtreecommitdiff
path: root/test/sql/select.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-02-01 18:20:20 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-02-01 18:20:20 +0000
commite39b98ca7ba8f791f5a359132adf3c9ff8e715c1 (patch)
tree20e986b9d406fcc07797219658680e6cb8df4c1f /test/sql/select.py
parent4b252f659e03d5226faa8c28d36d33ce4dccfb08 (diff)
downloadsqlalchemy-e39b98ca7ba8f791f5a359132adf3c9ff8e715c1.tar.gz
- Fixed missing _label attribute on Function object, others
when used in a select() with use_labels (such as when used in an ORM column_property()). [ticket:1302]
Diffstat (limited to 'test/sql/select.py')
-rw-r--r--test/sql/select.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index 2b721ba10..aeb53bf19 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -131,6 +131,30 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
select([ClauseList(column('a'), column('b'))]).select_from('sometable'),
'SELECT a, b FROM sometable'
)
+
+ def test_use_labels(self):
+ self.assert_compile(
+ select([table1.c.myid==5], use_labels=True),
+ "SELECT mytable.myid = :myid_1 AS anon_1 FROM mytable"
+ )
+
+ self.assert_compile(
+ select([func.foo()], use_labels=True),
+ "SELECT foo() AS foo_1"
+ )
+
+ self.assert_compile(
+ select([not_(True)], use_labels=True),
+ "SELECT NOT :param_1" # TODO: should this make an anon label ??
+ )
+
+ self.assert_compile(
+ select([cast("data", sqlite.SLInteger)], use_labels=True), # this will work with plain Integer in 0.6
+ "SELECT CAST(:param_1 AS INTEGER) AS anon_1"
+ )
+
+
+
def test_nested_uselabels(self):
"""test nested anonymous label generation. this
essentially tests the ANONYMOUS_LABEL regex.