Skip to content

Commit

Permalink
Use utf8mb4 in test_binary_prefix (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
methane authored Sep 3, 2021
1 parent 4bb85b2 commit aa28721
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit aa28721

Please sign in to comment.