summaryrefslogtreecommitdiff
path: root/test/sql/functions.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-03-25 16:51:29 +0000
committerJason Kirtland <jek@discorporate.us>2008-03-25 16:51:29 +0000
commit92a5df77538069efd9f8cfc14cf83807ce43c288 (patch)
tree3e5056cfae005a54d59c3c708df7b70d67f197f3 /test/sql/functions.py
parentdf1000839ba2925031afa2e9769a482add9f404e (diff)
downloadsqlalchemy-92a5df77538069efd9f8cfc14cf83807ce43c288.tar.gz
- Added generic func.random (non-standard SQL)
Diffstat (limited to 'test/sql/functions.py')
-rw-r--r--test/sql/functions.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/sql/functions.py b/test/sql/functions.py
index f6b1e67f1..e5c59b091 100644
--- a/test/sql/functions.py
+++ b/test/sql/functions.py
@@ -35,7 +35,7 @@ class CompileTest(TestBase, AssertsCompiledSQL):
def test_generic_now(self):
assert isinstance(func.now().type, sqltypes.DateTime)
-
+
for ret, dialect in [
('CURRENT_TIMESTAMP', sqlite.dialect()),
('now()', postgres.dialect()),
@@ -43,7 +43,19 @@ class CompileTest(TestBase, AssertsCompiledSQL):
('CURRENT_TIMESTAMP', oracle.dialect())
]:
self.assert_compile(func.now(), ret, dialect=dialect)
-
+
+ def test_generic_random(self):
+ assert func.random().type == sqltypes.NULLTYPE
+ assert isinstance(func.random(type_=Integer).type, Integer)
+
+ for ret, dialect in [
+ ('random()', sqlite.dialect()),
+ ('random()', postgres.dialect()),
+ ('rand()', mysql.dialect()),
+ ('random()', oracle.dialect())
+ ]:
+ self.assert_compile(func.random(), ret, dialect=dialect)
+
def test_constructor(self):
try:
func.current_timestamp('somearg')
@@ -79,7 +91,7 @@ class CompileTest(TestBase, AssertsCompiledSQL):
'myothertable',
column('otherid', Integer),
)
-
+
# test an expression with a function
self.assert_compile(func.lala(3, 4, literal("five"), table1.c.myid) * table2.c.otherid,
"lala(:lala_1, :lala_2, :param_1, mytable.myid) * myothertable.otherid")