Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_unicodedata.py

    r21 r391  
    2121
    2222    # update this, if the database changes
    23     expectedchecksum = '6ec65b65835614ec00634c674bba0e50cd32c189'
     23    expectedchecksum = '4504dffd035baea02c5b9de82bebc3d65e0e0baf'
    2424
    2525    def test_method_checksum(self):
    2626        h = hashlib.sha1()
    27         for i in range(65536):
     27        for i in range(0x10000):
    2828            char = unichr(i)
    2929            data = [
     
    8080
    8181    # update this, if the database changes
    82     expectedchecksum = '3136d5afd787dc2bcb1bdcac95e385349fbebbca'
     82    expectedchecksum = '6ccf1b1a36460d2694f9b0b0f0324942fe70ede6'
    8383
    8484    def test_function_checksum(self):
     
    119119        self.assertEqual(self.db.numeric(u'\u215b'), 0.125)
    120120        self.assertEqual(self.db.numeric(u'\u2468'), 9.0)
     121        self.assertEqual(self.db.numeric(u'\ua627'), 7.0)
    121122        self.assertEqual(self.db.numeric(u'\U00020000', None), None)
    122123
     
    185186        # The rest can be found in test_normalization.py
    186187        # 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)
    187206
    188207    def test_east_asian_width(self):
     
    218237        error = "SyntaxError: (unicode error) \N escapes not supported " \
    219238            "(can't load unicodedata module)"
    220         self.assertTrue(error in popen.stderr.read())
     239        self.assertIn(error, popen.stderr.read())
    221240
    222241    def test_decimal_numeric_consistent(self):
     
    231250                self.assertEqual(dec, self.db.numeric(c))
    232251                count += 1
    233         self.assert_(count >= 10) # should have tested at least the ASCII digits
     252        self.assertTrue(count >= 10) # should have tested at least the ASCII digits
    234253
    235254    def test_digit_numeric_consistent(self):
     
    244263                self.assertEqual(dec, self.db.numeric(c))
    245264                count += 1
    246         self.assert_(count >= 10) # should have tested at least the ASCII digits
     265        self.assertTrue(count >= 10) # should have tested at least the ASCII digits
    247266
    248267    def test_bug_1704793(self):
    249         self.assertEquals(self.db.lookup("GOTHIC LETTER FAIHU"), u'\U00010346')
     268        self.assertEqual(self.db.lookup("GOTHIC LETTER FAIHU"), u'\U00010346')
    250269
    251270    def test_ucd_510(self):
    252271        import unicodedata
    253272        # 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"))
    256275        # Also, we now have two ways of representing
    257276        # 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".")
    261280
    262281    def test_bug_5828(self):
     
    277296        self.assertEqual(u"\u01c6".title(), u"\u01c5")
    278297
     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
    279309def test_main():
    280310    test.test_support.run_unittest(
Note: See TracChangeset for help on using the changeset viewer.