Changeset 391 for python/trunk/Lib/test/test_unicodedata.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_unicodedata.py
r21 r391 21 21 22 22 # update this, if the database changes 23 expectedchecksum = ' 6ec65b65835614ec00634c674bba0e50cd32c189'23 expectedchecksum = '4504dffd035baea02c5b9de82bebc3d65e0e0baf' 24 24 25 25 def test_method_checksum(self): 26 26 h = hashlib.sha1() 27 for i in range( 65536):27 for i in range(0x10000): 28 28 char = unichr(i) 29 29 data = [ … … 80 80 81 81 # update this, if the database changes 82 expectedchecksum = ' 3136d5afd787dc2bcb1bdcac95e385349fbebbca'82 expectedchecksum = '6ccf1b1a36460d2694f9b0b0f0324942fe70ede6' 83 83 84 84 def test_function_checksum(self): … … 119 119 self.assertEqual(self.db.numeric(u'\u215b'), 0.125) 120 120 self.assertEqual(self.db.numeric(u'\u2468'), 9.0) 121 self.assertEqual(self.db.numeric(u'\ua627'), 7.0) 121 122 self.assertEqual(self.db.numeric(u'\U00020000', None), None) 122 123 … … 185 186 # The rest can be found in test_normalization.py 186 187 # which requires an external file. 188 189 def test_pr29(self): 190 # http://www.unicode.org/review/pr-29.html 191 # See issues #1054943 and #10254. 192 composed = (u"\u0b47\u0300\u0b3e", u"\u1100\u0300\u1161", 193 u'Li\u030dt-s\u1e73\u0301', 194 u'\u092e\u093e\u0930\u094d\u0915 \u091c\u093c' 195 + u'\u0941\u0915\u0947\u0930\u092c\u0930\u094d\u0917', 196 u'\u0915\u093f\u0930\u094d\u0917\u093f\u091c\u093c' 197 + 'u\u0938\u094d\u0924\u093e\u0928') 198 for text in composed: 199 self.assertEqual(self.db.normalize('NFC', text), text) 200 201 def test_issue10254(self): 202 # Crash reported in #10254 203 a = u'C\u0338' * 20 + u'C\u0327' 204 b = u'C\u0338' * 20 + u'\xC7' 205 self.assertEqual(self.db.normalize('NFC', a), b) 187 206 188 207 def test_east_asian_width(self): … … 218 237 error = "SyntaxError: (unicode error) \N escapes not supported " \ 219 238 "(can't load unicodedata module)" 220 self.assert True(error inpopen.stderr.read())239 self.assertIn(error, popen.stderr.read()) 221 240 222 241 def test_decimal_numeric_consistent(self): … … 231 250 self.assertEqual(dec, self.db.numeric(c)) 232 251 count += 1 233 self.assert _(count >= 10) # should have tested at least the ASCII digits252 self.assertTrue(count >= 10) # should have tested at least the ASCII digits 234 253 235 254 def test_digit_numeric_consistent(self): … … 244 263 self.assertEqual(dec, self.db.numeric(c)) 245 264 count += 1 246 self.assert _(count >= 10) # should have tested at least the ASCII digits265 self.assertTrue(count >= 10) # should have tested at least the ASCII digits 247 266 248 267 def test_bug_1704793(self): 249 self.assertEqual s(self.db.lookup("GOTHIC LETTER FAIHU"), u'\U00010346')268 self.assertEqual(self.db.lookup("GOTHIC LETTER FAIHU"), u'\U00010346') 250 269 251 270 def test_ucd_510(self): 252 271 import unicodedata 253 272 # In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0 254 self.assert _(unicodedata.mirrored(u"\u0f3a"))255 self.assert _(not unicodedata.ucd_3_2_0.mirrored(u"\u0f3a"))273 self.assertTrue(unicodedata.mirrored(u"\u0f3a")) 274 self.assertTrue(not unicodedata.ucd_3_2_0.mirrored(u"\u0f3a")) 256 275 # Also, we now have two ways of representing 257 276 # the upper-case mapping: as delta, or as absolute value 258 self.assert _(u"a".upper()==u'A')259 self.assert _(u"\u1d79".upper()==u'\ua77d')260 self.assert _(u".".upper()==u".")277 self.assertTrue(u"a".upper()==u'A') 278 self.assertTrue(u"\u1d79".upper()==u'\ua77d') 279 self.assertTrue(u".".upper()==u".") 261 280 262 281 def test_bug_5828(self): … … 277 296 self.assertEqual(u"\u01c6".title(), u"\u01c5") 278 297 298 def test_linebreak_7643(self): 299 for i in range(0x10000): 300 lines = (unichr(i) + u'A').splitlines() 301 if i in (0x0a, 0x0b, 0x0c, 0x0d, 0x85, 302 0x1c, 0x1d, 0x1e, 0x2028, 0x2029): 303 self.assertEqual(len(lines), 2, 304 r"\u%.4x should be a linebreak" % i) 305 else: 306 self.assertEqual(len(lines), 1, 307 r"\u%.4x should not be a linebreak" % i) 308 279 309 def test_main(): 280 310 test.test_support.run_unittest(
Note:
See TracChangeset
for help on using the changeset viewer.