summaryrefslogtreecommitdiff
path: root/test/dialect
diff options
context:
space:
mode:
authorpetit87 <west12capri12@gmail.com>2022-02-26 16:46:32 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-04 13:01:30 -0500
commit3cc9448ce311e4a18e746bddd55a2bf912e317c4 (patch)
tree2cab0721bfc78a58ed210d0f385c14db6d3a09e5 /test/dialect
parentc3a51918dccc19d1872c6095c27363bd54485890 (diff)
downloadsqlalchemy-3cc9448ce311e4a18e746bddd55a2bf912e317c4.tar.gz
Fix repr for MySQL SET, generic Enum
Fixed issues in :class:`_mysql.SET` datatype as well as :class:`.Enum` where the ``__repr__()`` method would not render all optional parameters in the string output, impacting the use of these types in Alembic autogenerate. Pull request for MySQL courtesy Yuki Nishimine. Fixes: #7720 Fixes: #7789 Closes: #7772 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7772 Pull-request-sha: d58845479f497f6b2e12d7df2e9eb2d6ac22109b Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: Idcec23eab4258511d9f32f4e3d78e511ea6021f1 (cherry picked from commit a926dea6b78c91b627f0f0b86cdc6a9279872e99)
Diffstat (limited to 'test/dialect')
-rw-r--r--test/dialect/mysql/test_types.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py
index 7bdf6f8ce..3afe6c385 100644
--- a/test/dialect/mysql/test_types.py
+++ b/test/dialect/mysql/test_types.py
@@ -1312,6 +1312,24 @@ class EnumSetTest(
[("", ""), ("", ""), ("two", "two"), (None, None)],
)
+ @testing.combinations(
+ (
+ [""],
+ {"retrieve_as_bitwise": True},
+ "SET('', retrieve_as_bitwise=True)",
+ ),
+ (["a"], {}, "SET('a')"),
+ (["a", "b", "c"], {}, "SET('a', 'b', 'c')"),
+ (
+ ["a", "b", "c"],
+ {"collation": "utf8_bin"},
+ "SET('a', 'b', 'c', collation='utf8_bin')",
+ ),
+ argnames="value,kw,expected",
+ )
+ def test_set_repr(self, value, kw, expected):
+ eq_(repr(mysql.SET(*value, **kw)), expected)
+
def colspec(c):
return testing.db.dialect.ddl_compiler(