#1571184: makeunicodedata.py now generates the functions _PyUnicode_ToNumeric,

_PyUnicode_IsLinebreak and _PyUnicode_IsWhitespace.

It now also parses the Unihan.txt for numeric values.
This commit is contained in:
Amaury Forgeot d'Arc 2009-10-06 19:56:32 +00:00
parent 85ea4bf781
commit d0052d17b1
7 changed files with 3328 additions and 1981 deletions

View file

@ -20,7 +20,7 @@ encoding = 'utf-8'
class UnicodeMethodsTest(unittest.TestCase):
# update this, if the database changes
expectedchecksum = '6ec65b65835614ec00634c674bba0e50cd32c189'
expectedchecksum = '0b915116051f3ed029a98542c2b7df63c9646272'
def test_method_checksum(self):
h = hashlib.sha1()
@ -79,7 +79,7 @@ class UnicodeDatabaseTest(unittest.TestCase):
class UnicodeFunctionsTest(UnicodeDatabaseTest):
# update this, if the database changes
expectedchecksum = '3136d5afd787dc2bcb1bdcac95e385349fbebbca'
expectedchecksum = 'd4169ccff998ebbd1ec007a0b3fbd66e5ccf0229'
def test_function_checksum(self):
data = []
@ -118,6 +118,7 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
self.assertEqual(self.db.numeric(u'9'), 9)
self.assertEqual(self.db.numeric(u'\u215b'), 0.125)
self.assertEqual(self.db.numeric(u'\u2468'), 9.0)
self.assertEqual(self.db.numeric(u'\ua627'), 7.0)
self.assertEqual(self.db.numeric(u'\U00020000', None), None)
self.assertRaises(TypeError, self.db.numeric)