MCPcopy Index your code
hub / github.com/python/cpython / test_method_checksum

Method test_method_checksum

Lib/test/test_unicodedata.py:62–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 '8b2615a9fc627676cbc0b6fac0191177df97ef5f')
61
62 def test_method_checksum(self):
63 h = hashlib.sha1()
64 for char in iterallchars():
65 s1 = char + 'abc'
66 s2 = char + 'ABC'
67 s3 = char + '123'
68 data = (
69 # Predicates (single char)
70 "01"[char.isalnum()],
71 "01"[char.isalpha()],
72 "01"[char.isdecimal()],
73 "01"[char.isdigit()],
74 "01"[char.islower()],
75 "01"[char.isnumeric()],
76 "01"[char.isspace()],
77 "01"[char.istitle()],
78 "01"[char.isupper()],
79
80 # Predicates (multiple chars)
81 "01"[s1.isalnum()],
82 "01"[s1.isalpha()],
83 "01"[s3.isdecimal()],
84 "01"[s3.isdigit()],
85 "01"[s1.islower()],
86 "01"[s3.isnumeric()],
87 "01"[(char + ' \t').isspace()],
88 "01"[s1.istitle()],
89 "01"[s2.isupper()],
90
91 # Mappings (single char)
92 char.lower(),
93 char.upper(),
94 char.title(),
95
96 # Mappings (multiple chars)
97 s1.lower(),
98 s2.upper(),
99 s1.title(),
100 s2.title(),
101
102 )
103 h.update(''.join(data).encode('utf-8', 'surrogatepass'))
104 result = h.hexdigest()
105 self.assertEqual(result, self.expectedchecksum)
106
107
108class BaseUnicodeFunctionsTest:

Callers

nothing calls this directly

Calls 15

iterallcharsFunction · 0.85
isalnumMethod · 0.80
isalphaMethod · 0.80
isdecimalMethod · 0.80
isdigitMethod · 0.80
islowerMethod · 0.80
isnumericMethod · 0.80
isspaceMethod · 0.80
istitleMethod · 0.80
isupperMethod · 0.80
hexdigestMethod · 0.80
lowerMethod · 0.45

Tested by

no test coverage detected