summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2022-09-21 14:07:07 (GMT)
committerGitHub <noreply@github.com>2022-09-21 14:07:07 (GMT)
commitd35b9d0a60d60fafc7fa1cb03ad65b703bb8861a (patch)
treef23499cdf886c6dd5bd2f10cf14b4202078f251f
parentad49555d5185fd2ec27a9c9ddc2b11b4f85c5b62 (diff)
downloadcpython-d35b9d0a60d60fafc7fa1cb03ad65b703bb8861a.zip
cpython-d35b9d0a60d60fafc7fa1cb03ad65b703bb8861a.tar.gz
cpython-d35b9d0a60d60fafc7fa1cb03ad65b703bb8861a.tar.bz2
[3.11] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96991)
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 3514697..85a3c2d 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)