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_strop.py

    r2 r391  
    1111
    1212    def test_atoi(self):
    13         self.assert_(strop.atoi(" 1 ") == 1)
     13        self.assertTrue(strop.atoi(" 1 ") == 1)
    1414        self.assertRaises(ValueError, strop.atoi, " 1x")
    1515        self.assertRaises(ValueError, strop.atoi, " x1 ")
    1616
    1717    def test_atol(self):
    18         self.assert_(strop.atol(" 1 ") == 1L)
     18        self.assertTrue(strop.atol(" 1 ") == 1L)
    1919        self.assertRaises(ValueError, strop.atol, " 1x")
    2020        self.assertRaises(ValueError, strop.atol, " x1 ")
    2121
    2222    def test_atof(self):
    23         self.assert_(strop.atof(" 1 ") == 1.0)
     23        self.assertTrue(strop.atof(" 1 ") == 1.0)
    2424        self.assertRaises(ValueError, strop.atof, " 1x")
    2525        self.assertRaises(ValueError, strop.atof, " x1 ")
    2626
    2727    def test_capitalize(self):
    28         self.assert_(strop.capitalize(" hello ") == " hello ")
    29         self.assert_(strop.capitalize("hello ") == "Hello ")
     28        self.assertTrue(strop.capitalize(" hello ") == " hello ")
     29        self.assertTrue(strop.capitalize("hello ") == "Hello ")
    3030
    3131    def test_find(self):
    32         self.assert_(strop.find("abcdefghiabc", "abc") == 0)
    33         self.assert_(strop.find("abcdefghiabc", "abc", 1) == 9)
    34         self.assert_(strop.find("abcdefghiabc", "def", 4) == -1)
     32        self.assertTrue(strop.find("abcdefghiabc", "abc") == 0)
     33        self.assertTrue(strop.find("abcdefghiabc", "abc", 1) == 9)
     34        self.assertTrue(strop.find("abcdefghiabc", "def", 4) == -1)
    3535
    3636    def test_rfind(self):
    37         self.assert_(strop.rfind("abcdefghiabc", "abc") == 9)
     37        self.assertTrue(strop.rfind("abcdefghiabc", "abc") == 9)
    3838
    3939    def test_lower(self):
    40         self.assert_(strop.lower("HeLLo") == "hello")
     40        self.assertTrue(strop.lower("HeLLo") == "hello")
    4141
    4242    def test_upper(self):
    43         self.assert_(strop.upper("HeLLo") == "HELLO")
     43        self.assertTrue(strop.upper("HeLLo") == "HELLO")
    4444
    4545    def test_swapcase(self):
    46         self.assert_(strop.swapcase("HeLLo cOmpUteRs") == "hEllO CoMPuTErS")
     46        self.assertTrue(strop.swapcase("HeLLo cOmpUteRs") == "hEllO CoMPuTErS")
    4747
    4848    def test_strip(self):
    49         self.assert_(strop.strip(" \t\n hello \t\n ") == "hello")
     49        self.assertTrue(strop.strip(" \t\n hello \t\n ") == "hello")
    5050
    5151    def test_lstrip(self):
    52         self.assert_(strop.lstrip(" \t\n hello \t\n ") == "hello \t\n ")
     52        self.assertTrue(strop.lstrip(" \t\n hello \t\n ") == "hello \t\n ")
    5353
    5454    def test_rstrip(self):
    55         self.assert_(strop.rstrip(" \t\n hello \t\n ") == " \t\n hello")
     55        self.assertTrue(strop.rstrip(" \t\n hello \t\n ") == " \t\n hello")
    5656
    5757    def test_replace(self):
    5858        replace = strop.replace
    59         self.assert_(replace("one!two!three!", '!', '@', 1)
     59        self.assertTrue(replace("one!two!three!", '!', '@', 1)
    6060                     == "one@two!three!")
    61         self.assert_(replace("one!two!three!", '!', '@', 2)
     61        self.assertTrue(replace("one!two!three!", '!', '@', 2)
    6262                     == "one@two@three!")
    63         self.assert_(replace("one!two!three!", '!', '@', 3)
     63        self.assertTrue(replace("one!two!three!", '!', '@', 3)
    6464                     == "one@two@three@")
    65         self.assert_(replace("one!two!three!", '!', '@', 4)
     65        self.assertTrue(replace("one!two!three!", '!', '@', 4)
    6666                     == "one@two@three@")
    6767
     
    7070        # string.replace() function.
    7171
    72         self.assert_(replace("one!two!three!", '!', '@', 0)
     72        self.assertTrue(replace("one!two!three!", '!', '@', 0)
    7373                     == "one@two@three@")
    74         self.assert_(replace("one!two!three!", '!', '@')
     74        self.assertTrue(replace("one!two!three!", '!', '@')
    7575                     == "one@two@three@")
    76         self.assert_(replace("one!two!three!", 'x', '@')
     76        self.assertTrue(replace("one!two!three!", 'x', '@')
    7777                     == "one!two!three!")
    78         self.assert_(replace("one!two!three!", 'x', '@', 2)
     78        self.assertTrue(replace("one!two!three!", 'x', '@', 2)
    7979                     == "one!two!three!")
    8080
    8181    def test_split(self):
    8282        split = strop.split
    83         self.assert_(split("this is the split function")
     83        self.assertTrue(split("this is the split function")
    8484                     == ['this', 'is', 'the', 'split', 'function'])
    85         self.assert_(split("a|b|c|d", '|') == ['a', 'b', 'c', 'd'])
    86         self.assert_(split("a|b|c|d", '|', 2) == ['a', 'b', 'c|d'])
    87         self.assert_(split("a b c d", None, 1) == ['a', 'b c d'])
    88         self.assert_(split("a b c d", None, 2) == ['a', 'b', 'c d'])
    89         self.assert_(split("a b c d", None, 3) == ['a', 'b', 'c', 'd'])
    90         self.assert_(split("a b c d", None, 4) == ['a', 'b', 'c', 'd'])
    91         self.assert_(split("a b c d", None, 0) == ['a', 'b', 'c', 'd'])
    92         self.assert_(split("a  b  c  d", None, 2) ==  ['a', 'b', 'c  d'])
     85        self.assertTrue(split("a|b|c|d", '|') == ['a', 'b', 'c', 'd'])
     86        self.assertTrue(split("a|b|c|d", '|', 2) == ['a', 'b', 'c|d'])
     87        self.assertTrue(split("a b c d", None, 1) == ['a', 'b c d'])
     88        self.assertTrue(split("a b c d", None, 2) == ['a', 'b', 'c d'])
     89        self.assertTrue(split("a b c d", None, 3) == ['a', 'b', 'c', 'd'])
     90        self.assertTrue(split("a b c d", None, 4) == ['a', 'b', 'c', 'd'])
     91        self.assertTrue(split("a b c d", None, 0) == ['a', 'b', 'c', 'd'])
     92        self.assertTrue(split("a  b  c  d", None, 2) ==  ['a', 'b', 'c  d'])
    9393
    9494    def test_join(self):
    95         self.assert_(strop.join(['a', 'b', 'c', 'd']) == 'a b c d')
    96         self.assert_(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd')
    97         self.assert_(strop.join(Sequence()) == 'w x y z')
     95        self.assertTrue(strop.join(['a', 'b', 'c', 'd']) == 'a b c d')
     96        self.assertTrue(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd')
     97        self.assertTrue(strop.join(Sequence()) == 'w x y z')
    9898
    9999        # try a few long ones
    100         self.assert_(strop.join(['x' * 100] * 100, ':')
     100        self.assertTrue(strop.join(['x' * 100] * 100, ':')
    101101                     == (('x' * 100) + ":") * 99 + "x" * 100)
    102         self.assert_(strop.join(('x' * 100,) * 100, ':')
     102        self.assertTrue(strop.join(('x' * 100,) * 100, ':')
    103103                     == (('x' * 100) + ":") * 99 + "x" * 100)
    104104
    105105    def test_maketrans(self):
    106         self.assert_(strop.maketrans("abc", "xyz") == transtable)
     106        self.assertTrue(strop.maketrans("abc", "xyz") == transtable)
    107107        self.assertRaises(ValueError, strop.maketrans, "abc", "xyzq")
    108108
    109109    def test_translate(self):
    110         self.assert_(strop.translate("xyzabcdef", transtable, "def")
     110        self.assertTrue(strop.translate("xyzabcdef", transtable, "def")
    111111                     == "xyzxyz")
    112112
     
    124124            pass
    125125        else:
    126             self.assertEquals(len(r), len(a) * 3)
     126            self.assertEqual(len(r), len(a) * 3)
    127127
    128128    @test_support.precisionbigmemtest(size=test_support._2G - 1, memuse=1)
     
    134134            pass # acceptable on 32-bit
    135135        else:
    136             self.assertEquals(len(r), len(a) * 3)
     136            self.assertEqual(len(r), len(a) * 3)
    137137
    138138transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
Note: See TracChangeset for help on using the changeset viewer.