[Python-checkins] [3.11] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96991)

ambv webhook-mailer at python.org
Wed Sep 21 10:07:25 EDT 2022


https://github.com/python/cpython/commit/d35b9d0a60d60fafc7fa1cb03ad65b703bb8861a
commit: d35b9d0a60d60fafc7fa1cb03ad65b703bb8861a
branch: 3.11
author: Łukasz Langa <lukasz at langa.pl>
committer: ambv <lukasz at langa.pl>
date: 2022-09-21T16:07:07+02:00
summary:

[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 at gmx.de>
(cherry picked from commit 5a32eeced2c537c13613dd4ff5b2767a37037294)

Co-authored-by: Batuhan Taskaya <isidentical at gmail.com>

files:
M Lib/test/test_unicodedata.py

diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 3514697f548..85a3c2d6d54 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -95,6 +95,13 @@ def test_function_checksum(self):
         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)



More information about the Python-checkins mailing list