summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/pytestplugin.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-03-10 23:54:52 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2021-03-15 20:11:20 -0400
commitdfa1d3b28f1a0abf1e11c76a94f7a65bf98d29af (patch)
tree975a06018edcc9a9fa75b709f40698842a82e494 /lib/sqlalchemy/testing/plugin/pytestplugin.py
parent28b0b6515af26ee3ba09600a8212849b2dae0699 (diff)
downloadsqlalchemy-dfa1d3b28f1a0abf1e11c76a94f7a65bf98d29af.tar.gz
CAST the elements in ARRAYs when using psycopg2
Adjusted the psycopg2 dialect to emit an explicit PostgreSQL-style cast for bound parameters that contain ARRAY elements. This allows the full range of datatypes to function correctly within arrays. The asyncpg dialect already generated these internal casts in the final statement. This also includes support for array slice updates as well as the PostgreSQL-specific :meth:`_postgresql.ARRAY.contains` method. Fixes: #6023 Change-Id: Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/pytestplugin.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
index 4eaaecebb..388d71c73 100644
--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
+++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
@@ -578,7 +578,9 @@ class PytestFixtureFunctions(plugin_base.FixtureFunctions):
"i": lambda obj: obj,
"r": repr,
"s": str,
- "n": operator.attrgetter("__name__"),
+ "n": lambda obj: obj.__name__
+ if hasattr(obj, "__name__")
+ else type(obj).__name__,
}
def combinations(self, *arg_sets, **kw):