diff options
author | Wonsup Yoon <pusnow@me.com> | 2018-06-15 12:03:14 (GMT) |
---|---|---|
committer | Xiang Zhang <angwerzx@126.com> | 2018-06-15 12:03:14 (GMT) |
commit | d134809cd3764c6a634eab7bb8995e3e2eff14d5 (patch) | |
tree | 6bcc3ec615c093c71b96ce1ce52594bacdc75466 /Lib/test/test_unicodedata.py | |
parent | ceeef10cdbc08561f9954e13bbed1cb2299a8c72 (diff) | |
download | cpython-d134809cd3764c6a634eab7bb8995e3e2eff14d5.zip cpython-d134809cd3764c6a634eab7bb8995e3e2eff14d5.tar.gz cpython-d134809cd3764c6a634eab7bb8995e3e2eff14d5.tar.bz2 |
bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958)
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]).
Diffstat (limited to 'Lib/test/test_unicodedata.py')
-rw-r--r-- | Lib/test/test_unicodedata.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py index 99dd0de..170778f 100644 --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -208,6 +208,19 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest): b = 'C\u0338' * 20 + '\xC7' self.assertEqual(self.db.normalize('NFC', a), b) + def test_issue29456(self): + # Fix #29456 + u1176_str_a = '\u1100\u1176\u11a8' + u1176_str_b = '\u1100\u1176\u11a8' + u11a7_str_a = '\u1100\u1175\u11a7' + u11a7_str_b = '\uae30\u11a7' + u11c3_str_a = '\u1100\u1175\u11c3' + u11c3_str_b = '\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, b'a') |