summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-06-16 02:30:04 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-06-16 02:30:04 +0000
commitefd4e6dd8a73b956c860d796606f8e6ad652c292 (patch)
treefc4e387f37e421d54068310eab5a01facb5f91c8 /test/dialect/postgresql
parent964c26feecc7607d6d3a66240c3f33f4ae9215d4 (diff)
parent46c0fa56e904f6a00e56343302c4cb39955fa038 (diff)
downloadsqlalchemy-efd4e6dd8a73b956c860d796606f8e6ad652c292.tar.gz
Merge "implement literal stringification for arrays" into main
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_types.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index 266263d5f..fd4b91db1 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -19,6 +19,7 @@ from sqlalchemy import Float
from sqlalchemy import func
from sqlalchemy import inspect
from sqlalchemy import Integer
+from sqlalchemy import literal
from sqlalchemy import MetaData
from sqlalchemy import null
from sqlalchemy import Numeric
@@ -52,6 +53,7 @@ from sqlalchemy.orm import Session
from sqlalchemy.sql import bindparam
from sqlalchemy.sql import operators
from sqlalchemy.sql import sqltypes
+from sqlalchemy.testing import expect_raises_message
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.assertions import assert_raises
from sqlalchemy.testing.assertions import assert_raises_message
@@ -64,6 +66,7 @@ from sqlalchemy.testing.assertsql import RegexSQL
from sqlalchemy.testing.schema import pep435_enum
from sqlalchemy.testing.suite import test_types as suite
from sqlalchemy.testing.util import round_decimal
+from sqlalchemy.types import UserDefinedType
class FloatCoercionTest(fixtures.TablesTest, AssertsExecutionResults):
@@ -1230,6 +1233,23 @@ class ArrayTest(AssertsCompiledSQL, fixtures.TestBase):
render_postcompile=True,
)
+ def test_array_literal_render_no_inner_render(self):
+ class MyType(UserDefinedType):
+ cache_ok = True
+
+ def get_col_spec(self, **kw):
+ return "MYTYPE"
+
+ with expect_raises_message(
+ NotImplementedError,
+ r"Don't know how to literal-quote value \[1, 2, 3\]",
+ ):
+ self.assert_compile(
+ select(literal([1, 2, 3], ARRAY(MyType()))),
+ "nothing",
+ literal_binds=True,
+ )
+
def test_array_in_str_psycopg2_cast(self):
expr = column("x", postgresql.ARRAY(String(15))).in_(
[["one", "two"], ["three", "four"]]