summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
authorDamian Dimmich <damian@tauri-tec.com>2014-07-01 13:24:30 +0400
committerDamian Dimmich <damian@tauri-tec.com>2014-07-01 13:24:30 +0400
commitceeee81017e5fb0ac03f4a102ffd6cce418f0b05 (patch)
treeb78060b91fa8f1d1bdbe86f911874104f7e4f0bf /test/dialect/postgresql
parent7f402761d91a79afd01072d7ab6e83bf64106ddc (diff)
downloadsqlalchemy-pr/101.tar.gz
jsonb support for <@, ?| and ?& added.pr/101
need to see if equality already works.
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_types.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index d4d7d3766..87250d467 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -2009,12 +2009,31 @@ class JSONBTest(JSONTest):
"test_table.test_column ? %(test_column_1)s"
)
+ def test_where_has_all(self):
+ self._test_where(
+ self.jsoncol.has_all({'name': 'r1', 'data': {"k1": "r1v1", "k2": "r1v2"}}),
+ "test_table.test_column ?& %(test_column_1)s"
+ )
+
+ def test_where_has_any(self):
+ self._test_where(
+ self.jsoncol.has_any(postgresql.array(['name', 'data'])),
+ "test_table.test_column ?| ARRAY[%(param_1)s, %(param_2)s]"
+ )
+
def test_where_contains(self):
self._test_where(
self.jsoncol.contains({"k1": "r1v1"}),
"test_table.test_column @> %(test_column_1)s"
)
+ def test_where_contained_by(self):
+ self._test_where(
+ self.jsoncol.contained_by({'foo': '1', 'bar': None}),
+ "test_table.test_column <@ %(test_column_1)s"
+ )
+
+
class JSONBRoundTripTest(JSONRoundTripTest):
__only_on__ = ('postgresql >= 9.4',)