OLD | NEW |
1 """ Test script for the unicodedata module. | 1 """ Test script for the unicodedata module. |
2 | 2 |
3 Written by Marc-Andre Lemburg (mal@lemburg.com). | 3 Written by Marc-Andre Lemburg (mal@lemburg.com). |
4 | 4 |
5 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. | 5 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. |
6 | 6 |
7 """ | 7 """ |
8 | 8 |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 count = 0 | 247 count = 0 |
248 for i in range(0x10000): | 248 for i in range(0x10000): |
249 c = chr(i) | 249 c = chr(i) |
250 dec = self.db.digit(c, -1) | 250 dec = self.db.digit(c, -1) |
251 if dec != -1: | 251 if dec != -1: |
252 self.assertEqual(dec, self.db.numeric(c)) | 252 self.assertEqual(dec, self.db.numeric(c)) |
253 count += 1 | 253 count += 1 |
254 self.assertTrue(count >= 10) # should have tested at least the ASCII dig
its | 254 self.assertTrue(count >= 10) # should have tested at least the ASCII dig
its |
255 | 255 |
256 def test_bug_1704793(self): | 256 def test_bug_1704793(self): |
257 self.assertEquals(self.db.lookup("GOTHIC LETTER FAIHU"), '\U00010346') | 257 self.assertEqual(self.db.lookup("GOTHIC LETTER FAIHU"), '\U00010346') |
258 | 258 |
259 def test_ucd_510(self): | 259 def test_ucd_510(self): |
260 import unicodedata | 260 import unicodedata |
261 # In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0 | 261 # In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0 |
262 self.assertTrue(unicodedata.mirrored("\u0f3a")) | 262 self.assertTrue(unicodedata.mirrored("\u0f3a")) |
263 self.assertTrue(not unicodedata.ucd_3_2_0.mirrored("\u0f3a")) | 263 self.assertTrue(not unicodedata.ucd_3_2_0.mirrored("\u0f3a")) |
264 # Also, we now have two ways of representing | 264 # Also, we now have two ways of representing |
265 # the upper-case mapping: as delta, or as absolute value | 265 # the upper-case mapping: as delta, or as absolute value |
266 self.assertTrue("a".upper()=='A') | 266 self.assertTrue("a".upper()=='A') |
267 self.assertTrue("\u1d79".upper()=='\ua77d') | 267 self.assertTrue("\u1d79".upper()=='\ua77d') |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 def test_main(): | 306 def test_main(): |
307 test.support.run_unittest( | 307 test.support.run_unittest( |
308 UnicodeMiscTest, | 308 UnicodeMiscTest, |
309 UnicodeMethodsTest, | 309 UnicodeMethodsTest, |
310 UnicodeFunctionsTest | 310 UnicodeFunctionsTest |
311 ) | 311 ) |
312 | 312 |
313 if __name__ == "__main__": | 313 if __name__ == "__main__": |
314 test_main() | 314 test_main() |
OLD | NEW |