MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_utf8

Function test_utf8

pymysql/tests/test_charset.py:4–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def test_utf8():
5 utf8mb3 = pymysql.charset.charset_by_name("utf8mb3")
6 assert utf8mb3.name == "utf8mb3"
7 assert utf8mb3.collation == "utf8mb3_general_ci"
8 assert (
9 repr(utf8mb3)
10 == "Charset(id=33, name='utf8mb3', collation='utf8mb3_general_ci')"
11 )
12
13 # MySQL 8.0 changed the default collation for utf8mb4.
14 # But we use old default for compatibility.
15 utf8mb4 = pymysql.charset.charset_by_name("utf8mb4")
16 assert utf8mb4.name == "utf8mb4"
17 assert utf8mb4.collation == "utf8mb4_general_ci"
18 assert (
19 repr(utf8mb4)
20 == "Charset(id=45, name='utf8mb4', collation='utf8mb4_general_ci')"
21 )
22
23 # utf8 is alias of utf8mb4 since MySQL 8.0, and PyMySQL v1.1.
24 lowercase_utf8 = pymysql.charset.charset_by_name("utf8")
25 assert lowercase_utf8 == utf8mb4
26
27 # Regardless of case, UTF8 (which is special cased) should resolve to the same thing
28 uppercase_utf8 = pymysql.charset.charset_by_name("UTF8")
29 mixedcase_utf8 = pymysql.charset.charset_by_name("UtF8")
30 assert uppercase_utf8 == lowercase_utf8
31 assert mixedcase_utf8 == lowercase_utf8
32
33
34def test_case_sensitivity():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected