Changeset 391 for python/trunk/Lib/test/test_augassign.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_augassign.py
r2 r391 1 1 # Augmented assignment test. 2 2 3 from test.test_support import run_unittest 3 from test.test_support import run_unittest, check_py3k_warnings 4 4 import unittest 5 5 … … 20 20 if 1/2 == 0: 21 21 # classic division 22 self.assertEqual s(x, 3)22 self.assertEqual(x, 3) 23 23 else: 24 24 # new-style division (with -Qnew) 25 self.assertEquals(x, 3.0) 25 self.assertEqual(x, 3.0) 26 27 def test_with_unpacking(self): 28 self.assertRaises(SyntaxError, compile, "x, b += 3", "<test>", "exec") 26 29 27 30 def testInList(self): … … 38 41 x[0] /= 2 39 42 if 1/2 == 0: 40 self.assertEqual s(x[0], 3)43 self.assertEqual(x[0], 3) 41 44 else: 42 self.assertEqual s(x[0], 3.0)45 self.assertEqual(x[0], 3.0) 43 46 44 47 def testInDict(self): … … 55 58 x[0] /= 2 56 59 if 1/2 == 0: 57 self.assertEqual s(x[0], 3)60 self.assertEqual(x[0], 3) 58 61 else: 59 self.assertEqual s(x[0], 3.0)62 self.assertEqual(x[0], 3.0) 60 63 61 64 def testSequences(self): … … 64 67 x *= 2 65 68 66 self.assertEqual s(x, [1, 2, 3, 4, 1, 2, 3, 4])69 self.assertEqual(x, [1, 2, 3, 4, 1, 2, 3, 4]) 67 70 68 71 x = [1, 2, 3] … … 71 74 y[1:2] += [1] 72 75 73 self.assertEqual s(x, [1, 2, 1, 2, 3])74 self.assert _(x is y)76 self.assertEqual(x, [1, 2, 1, 2, 3]) 77 self.assertTrue(x is y) 75 78 76 79 def testCustomMethods1(self): … … 97 100 x += 10 98 101 99 self.assert _(isinstance(x, aug_test))100 self.assert _(y is not x)101 self.assertEqual s(x.val, 11)102 self.assertIsInstance(x, aug_test) 103 self.assertTrue(y is not x) 104 self.assertEqual(x.val, 11) 102 105 103 106 x = aug_test2(2) … … 105 108 x += 10 106 109 107 self.assert _(y is x)108 self.assertEqual s(x.val, 12)110 self.assertTrue(y is x) 111 self.assertEqual(x.val, 12) 109 112 110 113 x = aug_test3(3) … … 112 115 x += 10 113 116 114 self.assert _(isinstance(x, aug_test3))115 self.assert _(y is not x)116 self.assertEqual s(x.val, 13)117 self.assertIsInstance(x, aug_test3) 118 self.assertTrue(y is not x) 119 self.assertEqual(x.val, 13) 117 120 118 121 … … 282 285 x <<= 1 283 286 284 test_self.assertEqual s(output, '''\287 test_self.assertEqual(output, '''\ 285 288 __add__ called 286 289 __radd__ called … … 322 325 323 326 def test_main(): 324 run_unittest(AugAssignTest) 327 with check_py3k_warnings(("classic int division", DeprecationWarning)): 328 run_unittest(AugAssignTest) 325 329 326 330 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.