summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBatuhan Taskaya <isidentical@gmail.com>2022-09-21 12:52:40 (GMT)
committerGitHub <noreply@github.com>2022-09-21 12:52:40 (GMT)
commit5a32eeced2c537c13613dd4ff5b2767a37037294 (patch)
treee73d0ea61bf2ae8d4ee2fdf08f7b303f6ef7a18e /Lib/test
parente5ab0b6aa68009a3f50b141ec013dacee3676db9 (diff)
downloadcpython-5a32eeced2c537c13613dd4ff5b2767a37037294.zip
cpython-5a32eeced2c537c13613dd4ff5b2767a37037294.tar.gz
cpython-5a32eeced2c537c13613dd4ff5b2767a37037294.tar.bz2
gh-96954: Add tests for unicodedata.name/lookup (#96955)
They were undertested, and since #96954 might involve a rewrite of this part of the code we want to ensure that there won't be any behavioral change. Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_unicodedata.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 0c31d80..a85bda3 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -71,7 +71,7 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
# Update this if the database changes. Make sure to do a full rebuild
# (e.g. 'make distclean && make') to get the correct checksum.
- expectedchecksum = '84b88a89f40aeae96852732f9dc0ee08be49780f'
+ expectedchecksum = '26ff0d31c14194b4606a5b3a81ac36df3a14e331'
@requires_resource('cpu')
def test_function_checksum(self):
@@ -91,11 +91,19 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
str(self.db.mirrored(char)),
str(self.db.combining(char)),
unicodedata.east_asian_width(char),
+ self.db.name(char, ""),
]
h.update(''.join(data).encode("ascii"))
result = h.hexdigest()
self.assertEqual(result, self.expectedchecksum)
+ @requires_resource('cpu')
+ def test_name_inverse_lookup(self):
+ for i in range(sys.maxunicode + 1):
+ char = chr(i)
+ if looked_name := self.db.name(char, None):
+ self.assertEqual(self.db.lookup(looked_name), char)
+
def test_digit(self):
self.assertEqual(self.db.digit('A', None), None)
self.assertEqual(self.db.digit('9'), 9)