]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fixes: #7720 7772/head
authorpetit87 <west12capri12@gmail.com>
Sat, 26 Feb 2022 15:35:40 +0000 (00:35 +0900)
committerpetit87 <west12capri12@gmail.com>
Sat, 26 Feb 2022 15:43:50 +0000 (00:43 +0900)
lib/sqlalchemy/dialects/mysql/enumerated.py
test/dialect/mysql/test_types.py

index 875858871521419b43bb65b564d57abfac6975ed..bf402bbe7920a3d0a55ad65cb2ea05917d92ac55 100644 (file)
@@ -233,3 +233,6 @@ class SET(_StringType):
     def adapt(self, impltype, **kw):
         kw["retrieve_as_bitwise"] = self.retrieve_as_bitwise
         return util.constructor_copy(self, impltype, *self.values, **kw)
+
+    def __repr__(self):
+        return util.generic_repr(self, to_inspect=[SET, _StringType])
index 3d26e1d07f2e878215a465d7457dde0cc572cc73..ea36d7f49b6b1e01a95a6006dc3238eebbe146af 100644 (file)
@@ -1310,6 +1310,20 @@ class EnumSetTest(
             [("", ""), ("", ""), ("two", "two"), (None, None)],
         )
 
+    @testing.combinations(
+        ([""]),
+        (["a"]),
+        (["a", "b"]),
+        (["a", "b", "c"]),
+        argnames="value",
+    )
+    def test_set_repr(self, value):
+        val = ", ".join((f"'{i}'" for i in value))
+        eq_(
+            repr(Column("e", mysql.SET(*value, retrieve_as_bitwise=True))),
+            f"Column('e', SET({val}), table=None)",
+        )
+
 
 def colspec(c):
     return testing.db.dialect.ddl_compiler(