This amends the fix for #7789.
Fixes: #7598
Change-Id: I067a081d743f1efaf8288601bec0400712012265
.. change::
:tags: bug, sql, mysql
- :tickets: 7720, 7789
+ :tickets: 7720, 7789, 7598
Fixed issues in :class:`_mysql.SET` datatype as well as :class:`.Enum`
where the ``__repr__()`` method would not render all optional parameters in
self.validate_strings = kw.pop("validate_strings", False)
if self.enums:
- length = max(len(x) for x in self.enums)
+ self._default_length = length = max(len(x) for x in self.enums)
else:
- length = 0
+ self._default_length = length = 0
if not self.native_enum and length_arg is not NO_ARG:
if length_arg < length:
raise ValueError(
additional_kw=[
("native_enum", True),
("create_constraint", False),
+ ("length", self._default_length),
],
to_inspect=[Enum, SchemaType],
)
"Enum('x', 'y', name='somename', create_constraint=True)",
)
+ def test_repr_three(self):
+ e = Enum("x", "y", native_enum=False, length=255)
+ eq_(
+ repr(e),
+ "Enum('x', 'y', native_enum=False, length=255)",
+ )
+
def test_length_native(self):
e = Enum("x", "y", "long", length=42)