Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Delta Between Two Patch Sets: Lib/test/test_augassign.py

Issue 25958: Implicit ABCs have no means of "anti-registration"
Left Patch Set: Created 4 years, 1 month ago
Right Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/_collections_abc.py ('k') | Lib/test/test_binop.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Augmented assignment test. 1 # Augmented assignment test.
2 2
3 import unittest 3 import unittest
4 4
5 5
6 class AugAssignTest(unittest.TestCase): 6 class AugAssignTest(unittest.TestCase):
7 def testBasic(self): 7 def testBasic(self):
8 x = 2 8 x = 2
9 x += 1 9 x += 1
10 x *= 2 10 x *= 2
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 y = x 106 y = x
107 x += 10 107 x += 10
108 108
109 self.assertIsInstance(x, aug_test3) 109 self.assertIsInstance(x, aug_test3)
110 self.assertTrue(y is not x) 110 self.assertTrue(y is not x)
111 self.assertEqual(x.val, 13) 111 self.assertEqual(x.val, 13)
112 112
113 x = aug_test4(4) 113 x = aug_test4(4)
114 with self.assertRaises(TypeError): 114 with self.assertRaises(TypeError):
115 x += 10 115 x += 10
116
116 117
117 def testCustomMethods2(test_self): 118 def testCustomMethods2(test_self):
118 output = [] 119 output = []
119 120
120 class testall: 121 class testall:
121 def __add__(self, val): 122 def __add__(self, val):
122 output.append("__add__ called") 123 output.append("__add__ called")
123 def __radd__(self, val): 124 def __radd__(self, val):
124 output.append("__radd__ called") 125 output.append("__radd__ called")
125 def __iadd__(self, val): 126 def __iadd__(self, val):
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 __rshift__ called 317 __rshift__ called
317 __rrshift__ called 318 __rrshift__ called
318 __irshift__ called 319 __irshift__ called
319 __lshift__ called 320 __lshift__ called
320 __rlshift__ called 321 __rlshift__ called
321 __ilshift__ called 322 __ilshift__ called
322 '''.splitlines()) 323 '''.splitlines())
323 324
324 if __name__ == '__main__': 325 if __name__ == '__main__':
325 unittest.main() 326 unittest.main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+