Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/test_MySQLdb_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,19 @@ def test_binary_prefix(self):
for binary_prefix in (True, False, None):
kwargs = self.connect_kwargs.copy()
# needs to be set to can guarantee CHARSET response for normal strings
kwargs["charset"] = "utf8"
kwargs["charset"] = "utf8mb4"
if binary_prefix is not None:
kwargs["binary_prefix"] = binary_prefix

with closing(connection_factory(**kwargs)) as conn:
with closing(conn.cursor()) as c:
c.execute("SELECT CHARSET(%s)", (MySQLdb.Binary(b"raw bytes"),))
self.assertEqual(
c.fetchall()[0][0], "binary" if binary_prefix else "utf8"
c.fetchall()[0][0], "binary" if binary_prefix else "utf8mb4"
)
# normal strings should not get prefix
c.execute("SELECT CHARSET(%s)", ("str",))
self.assertEqual(c.fetchall()[0][0], "utf8")
self.assertEqual(c.fetchall()[0][0], "utf8mb4")


if __name__ == "__main__":
Expand Down