summaryrefslogtreecommitdiff
path: root/test/dialect
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-05-12 14:34:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2023-05-12 15:09:33 -0400
commit11a1d5e70450300310ff7fafeeb03fe1baa9380e (patch)
tree1dcb0c0e3ee15763d7434b28229201218859be8a /test/dialect
parent169d6e6804c0e6bbb5f8b2fa4217e659b49a0d9f (diff)
downloadsqlalchemy-11a1d5e70450300310ff7fafeeb03fe1baa9380e.tar.gz
include create_type in pg.ENUM.adapt; test all attrs
Fixed apparently very old issue where the :paramref:`_postgresql.ENUM.create_type` parameter, when set to its non-default of ``False``, would not be propagated when the :class:`_schema.Column` which it's a part of were copied, as is common when using ORM Declarative mixins. Fixes: #9773 Change-Id: I79a7c6f052ec39b42400d92bf591c791feca573b
Diffstat (limited to 'test/dialect')
-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 f322bf354..5df8bc0a5 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -231,6 +231,25 @@ class NamedTypeTest(
is_(e2.native_enum, True)
is_(e3.native_enum, True)
+ @testing.combinations(
+ ("name", "foobar", "name"),
+ ("validate_strings", True, "validate_strings"),
+ ("omit_aliases", False, "_omit_aliases"),
+ ("create_type", False, "create_type"),
+ ("create_type", True, "create_type"),
+ ("schema", "someschema", "schema"),
+ ("inherit_schema", True, "inherit_schema"),
+ ("metadata", MetaData(), "metadata"),
+ ("values_callable", lambda x: None, "values_callable"),
+ )
+ def test_enum_copy_args(self, argname, value, attrname):
+ kw = {argname: value}
+ e1 = ENUM("a", "b", "c", **kw)
+
+ e1_copy = e1.copy()
+
+ eq_(getattr(e1_copy, attrname), value)
+
def test_enum_create_table(self, metadata, connection):
metadata = self.metadata
t1 = Table(