summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2018-06-15 21:26:55 +0800
committerGitHub <noreply@github.com>2018-06-15 21:26:55 +0800
commit1889c4cbd62e200fa4cde3d6219e0aadf9bd8149 (patch)
tree884cddef4342e2ee2ed415b122e65eaea83f5789 /Lib
parentfc8ea20c6f8571de96791bc5f7f2d693406024c7 (diff)
downloadcpython-git-1889c4cbd62e200fa4cde3d6219e0aadf9bd8149.tar.gz
bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958) (GH-7704)
Hangul composition check boundaries are wrong for the second character ([0x1161, 0x1176) instead of [0x1161, 0x1176]) and third character ((0x11A7, 0x11C3) instead of [0x11A7, 0x11C3]).. (cherry picked from commit d134809cd3764c6a634eab7bb8995e3e2eff14d5) Co-authored-by: Wonsup Yoon <pusnow@me.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_unicodedata.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index c30ecf4c5b..11f2cda820 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -204,6 +204,19 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
b = u'C\u0338' * 20 + u'\xC7'
self.assertEqual(self.db.normalize('NFC', a), b)
+ def test_issue29456(self):
+ # Fix #29456
+ u1176_str_a = u'\u1100\u1176\u11a8'
+ u1176_str_b = u'\u1100\u1176\u11a8'
+ u11a7_str_a = u'\u1100\u1175\u11a7'
+ u11a7_str_b = u'\uae30\u11a7'
+ u11c3_str_a = u'\u1100\u1175\u11c3'
+ u11c3_str_b = u'\uae30\u11c3'
+ self.assertEqual(self.db.normalize('NFC', u1176_str_a), u1176_str_b)
+ self.assertEqual(self.db.normalize('NFC', u11a7_str_a), u11a7_str_b)
+ self.assertEqual(self.db.normalize('NFC', u11c3_str_a), u11c3_str_b)
+
+
def test_east_asian_width(self):
eaw = self.db.east_asian_width
self.assertRaises(TypeError, eaw, 'a')