mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Use utf8mb4 in test_binary_prefix (#501)
This commit is contained in:
@ -182,7 +182,7 @@ VALUES (1,
|
|||||||
for binary_prefix in (True, False, None):
|
for binary_prefix in (True, False, None):
|
||||||
kwargs = self.connect_kwargs.copy()
|
kwargs = self.connect_kwargs.copy()
|
||||||
# needs to be set to can guarantee CHARSET response for normal strings
|
# needs to be set to can guarantee CHARSET response for normal strings
|
||||||
kwargs["charset"] = "utf8"
|
kwargs["charset"] = "utf8mb4"
|
||||||
if binary_prefix is not None:
|
if binary_prefix is not None:
|
||||||
kwargs["binary_prefix"] = binary_prefix
|
kwargs["binary_prefix"] = binary_prefix
|
||||||
|
|
||||||
@ -190,11 +190,11 @@ VALUES (1,
|
|||||||
with closing(conn.cursor()) as c:
|
with closing(conn.cursor()) as c:
|
||||||
c.execute("SELECT CHARSET(%s)", (MySQLdb.Binary(b"raw bytes"),))
|
c.execute("SELECT CHARSET(%s)", (MySQLdb.Binary(b"raw bytes"),))
|
||||||
self.assertEqual(
|
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
|
# normal strings should not get prefix
|
||||||
c.execute("SELECT CHARSET(%s)", ("str",))
|
c.execute("SELECT CHARSET(%s)", ("str",))
|
||||||
self.assertEqual(c.fetchall()[0][0], "utf8")
|
self.assertEqual(c.fetchall()[0][0], "utf8mb4")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Reference in New Issue
Block a user