8000 bpo-37758: Extend unicodedata checksum tests to cover all of Unicode. · python/cpython@517484c · GitHub
[go: up one dir, main page]

Skip to content

Commit 517484c

Browse files
committed
bpo-37758: Extend unicodedata checksum tests to cover all of Unicode.
Unicode has grown since Python first gained support for it, when Unicode itself was still rather new. This pair of test cases was added in commit 6a20ee7 back in 2000, and they haven't needed to change much since then. But do change them to look beyond the Basic Multilingual Plane (range(0x10000)) and cover all 17 planes of Unicode's final form. This adds about 5 seconds to the test suite's runtime. Mark the tests as CPU-using accordingly.
1 parent 39de95b commit 517484c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Lib/test/test_unicodedata.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
import sys
1212
import unicodedata
1313
import unittest
14-
from test.support import open_urlresource, script_helper
14+
from test.support import open_urlresource, requires_resource, script_helper
1515

1616

1717
class UnicodeMethodsTest(unittest.TestCase):
1818

1919
# update this, if the database changes
20-
expectedchecksum = '9129d6f2bdf008a81c2476e5b5127014a62130c1'
20+
expectedchecksum = 'e728278035eb76cf92d86f07852266b0433f16a5'
2121

22+
@requires_resource('cpu')
2223
def test_method_checksum(self):
2324
h = hashlib.sha1()
24-
for i in range(0x10000):
25+
for i in range(sys.maxunicode + 1):
2526
char = chr(i)
2627
data = [
2728
# Predicates (single char)
@@ -69,12 +70,14 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
6970

7071
# Update this if the database changes. Make sure to do a full rebuild
7172
# (e.g. 'make distclean && make') to get the correct checksum.
72-
expectedchecksum = 'c44a49ca7c5cb6441640fe174ede604b45028652'
73+
expectedchecksum = '4bcbf9df344114b1ebc95b904f4352dd250dff7e'
74+
75+
@requires_resource('cpu')
7376
def test_function_checksum(self):
7477
data = []
7578
h = hashlib.sha1()
7679

77-
for i in range(0x10000):
80+
for i in range(sys.maxunicode + 1):
7881
char = chr(i)
7982
data = [
8083
# Properties

0 commit comments

Comments
 (0)
0