summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py50
1 files changed, 49 insertions, 1 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index ff958e7b8..3337fa6ab 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -20,7 +20,7 @@ from sqlalchemy.dialects.postgresql import base as postgresql
from sqlalchemy.dialects.postgresql import HSTORE, hstore, array, ARRAY
from sqlalchemy.util.compat import decimal
from sqlalchemy.testing.util import round_decimal
-from sqlalchemy.sql import table, column
+from sqlalchemy.sql import table, column, operators
import logging
import re
@@ -290,6 +290,26 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'x && %(x_1)s',
checkparams={'x_1': [3]}
)
+ self.assert_compile(
+ postgresql.Any(4, c),
+ '%(param_1)s = ANY (x)',
+ checkparams={'param_1': 4}
+ )
+ self.assert_compile(
+ c.any(5, operator=operators.ne),
+ '%(param_1)s != ANY (x)',
+ checkparams={'param_1': 5}
+ )
+ self.assert_compile(
+ postgresql.All(6, c, operator=operators.gt),
+ '%(param_1)s > ALL (x)',
+ checkparams={'param_1': 6}
+ )
+ self.assert_compile(
+ c.all(7, operator=operators.lt),
+ '%(param_1)s < ALL (x)',
+ checkparams={'param_1': 7}
+ )
def test_array_literal_type(self):
is_(postgresql.array([1, 2]).type._type_affinity, postgresql.ARRAY)
@@ -2274,6 +2294,34 @@ class ArrayTest(fixtures.TestBase, AssertsExecutionResults):
[4, 5, 6]
)
+ def test_array_any_exec(self):
+ with testing.db.connect() as conn:
+ conn.execute(
+ arrtable.insert(),
+ intarr=[4, 5, 6]
+ )
+ eq_(
+ conn.scalar(
+ select([arrtable.c.intarr]).
+ where(postgresql.Any(5, arrtable.c.intarr))
+ ),
+ [4, 5, 6]
+ )
+
+ def test_array_all_exec(self):
+ with testing.db.connect() as conn:
+ conn.execute(
+ arrtable.insert(),
+ intarr=[4, 5, 6]
+ )
+ eq_(
+ conn.scalar(
+ select([arrtable.c.intarr]).
+ where(arrtable.c.intarr.all(4, operator=operators.le))
+ ),
+ [4, 5, 6]
+ )
+
@testing.provide_metadata
def test_tuple_flag(self):
metadata = self.metadata