summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-11-07 15:31:48 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-11-11 14:37:55 -0500
commit01cbf4d7b8acab54a054bb36dc2792b518b5cd1f (patch)
tree09e59ba5a962f02444ca39d8f242c0b3bd86cdb0 /test/dialect/postgresql
parentbbe754784ae4630dd0ebf30d3bc2be566f8a8fef (diff)
downloadsqlalchemy-01cbf4d7b8acab54a054bb36dc2792b518b5cd1f.tar.gz
Add type accessors for JSON indexed/pathed element access
Added new accessors to expressions of type :class:`.JSON` to allow for specific datatype access and comparison, covering strings, integers, numeric, boolean elements. This revises the documented approach of CASTing to string when comparing values, instead adding specific functionality into the PostgreSQL, SQlite, MySQL dialects to reliably deliver these basic types in all cases. The change also delivers a new feature to the test exclusions system so that combinations and exclusions can be used together. Fixes: #4276 Change-Id: Ica5a926c060feb40a0a7cd60b9d6e061d7825728
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_types.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index 1eb8677bf..6bcfb1736 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -57,6 +57,7 @@ from sqlalchemy.testing.assertions import AssertsExecutionResults
from sqlalchemy.testing.assertions import ComparesTables
from sqlalchemy.testing.assertions import eq_
from sqlalchemy.testing.assertions import is_
+from sqlalchemy.testing.suite import test_types as suite
from sqlalchemy.testing.util import round_decimal
@@ -3223,3 +3224,15 @@ class JSONBRoundTripTest(JSONRoundTripTest):
@testing.requires.postgresql_utf8_server_encoding
def test_unicode_round_trip_native(self):
super(JSONBRoundTripTest, self).test_unicode_round_trip_native()
+
+
+class JSONBSuiteTest(suite.JSONTest):
+ __requires__ = ("postgresql_jsonb",)
+
+ datatype = JSONB
+
+
+class JSONBCastSuiteTest(suite.JSONStringCastIndexTest):
+ __requires__ = ("postgresql_jsonb",)
+
+ datatype = JSONB