summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2022-09-21 13:51:33 (GMT)
committerGitHub <noreply@github.com>2022-09-21 13:51:33 (GMT)
commitc112489f877a37cd6e887f0893fc1f4843c168fa (patch)
treef6f2628f8f61b43d66f898b30ecc4239ca245c65
parentc166541b25baedfde9f57f87f2dbd7e3f2f8a6e1 (diff)
downloadcpython-c112489f877a37cd6e887f0893fc1f4843c168fa.zip
cpython-c112489f877a37cd6e887f0893fc1f4843c168fa.tar.gz
cpython-c112489f877a37cd6e887f0893fc1f4843c168fa.tar.bz2
[3.10] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96992)
They were undertested, and since GH-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> (cherry picked from commit 5a32eeced2c537c13613dd4ff5b2767a37037294) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
-rw-r--r--Lib/test/test_unicodedata.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 213b3cf..2a93f0f 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -95,6 +95,13 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
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)