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

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

Issue 16510: Using appropriate checks in tests
Left Patch Set: Created 5 years, 11 months ago
Right Patch Set: Created 5 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/test/test_fnmatch.py ('k') | Lib/test/test_functools.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 from test import support 1 from test import support
2 import types 2 import types
3 import unittest 3 import unittest
4 4
5 5
6 def global_function(): 6 def global_function():
7 def inner_function(): 7 def inner_function():
8 class LocalClass: 8 class LocalClass:
9 pass 9 pass
10 global inner_global_function
11 def inner_global_function():
12 def inner_function2():
13 pass
14 return inner_function2
10 return LocalClass 15 return LocalClass
11 return lambda: inner_function 16 return lambda: inner_function
12 17
13 18
14 class FuncAttrsTest(unittest.TestCase): 19 class FuncAttrsTest(unittest.TestCase):
15 def setUp(self): 20 def setUp(self):
16 class F: 21 class F:
17 def a(self): 22 def a(self):
18 pass 23 pass
19 def b(): 24 def b():
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 # PEP 3155 114 # PEP 3155
110 self.assertEqual(self.b.__qualname__, 'FuncAttrsTest.setUp.<locals>.b') 115 self.assertEqual(self.b.__qualname__, 'FuncAttrsTest.setUp.<locals>.b')
111 self.assertEqual(FuncAttrsTest.setUp.__qualname__, 'FuncAttrsTest.setUp' ) 116 self.assertEqual(FuncAttrsTest.setUp.__qualname__, 'FuncAttrsTest.setUp' )
112 self.assertEqual(global_function.__qualname__, 'global_function') 117 self.assertEqual(global_function.__qualname__, 'global_function')
113 self.assertEqual(global_function().__qualname__, 118 self.assertEqual(global_function().__qualname__,
114 'global_function.<locals>.<lambda>') 119 'global_function.<locals>.<lambda>')
115 self.assertEqual(global_function()().__qualname__, 120 self.assertEqual(global_function()().__qualname__,
116 'global_function.<locals>.inner_function') 121 'global_function.<locals>.inner_function')
117 self.assertEqual(global_function()()().__qualname__, 122 self.assertEqual(global_function()()().__qualname__,
118 'global_function.<locals>.inner_function.<locals>.Local Class') 123 'global_function.<locals>.inner_function.<locals>.Local Class')
124 self.assertEqual(inner_global_function.__qualname__, 'inner_global_funct ion')
125 self.assertEqual(inner_global_function().__qualname__, 'inner_global_fun ction.<locals>.inner_function2')
119 self.b.__qualname__ = 'c' 126 self.b.__qualname__ = 'c'
120 self.assertEqual(self.b.__qualname__, 'c') 127 self.assertEqual(self.b.__qualname__, 'c')
121 self.b.__qualname__ = 'd' 128 self.b.__qualname__ = 'd'
122 self.assertEqual(self.b.__qualname__, 'd') 129 self.assertEqual(self.b.__qualname__, 'd')
123 # __qualname__ must be a string 130 # __qualname__ must be a string
124 self.cannot_set_attr(self.b, '__qualname__', 7, TypeError) 131 self.cannot_set_attr(self.b, '__qualname__', 7, TypeError)
125 132
126 def test___code__(self): 133 def test___code__(self):
127 num_one, num_two = 7, 8 134 num_one, num_two = 7, 8
128 def a(): pass 135 def a(): pass
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 376
370 def test_main(): 377 def test_main():
371 support.run_unittest(FunctionPropertiesTest, InstancemethodAttrTest, 378 support.run_unittest(FunctionPropertiesTest, InstancemethodAttrTest,
372 ArbitraryFunctionAttrTest, FunctionDictsTest, 379 ArbitraryFunctionAttrTest, FunctionDictsTest,
373 FunctionDocstringTest, CellTest, 380 FunctionDocstringTest, CellTest,
374 StaticMethodAttrsTest, 381 StaticMethodAttrsTest,
375 BuiltinFunctionPropertiesTest) 382 BuiltinFunctionPropertiesTest)
376 383
377 if __name__ == "__main__": 384 if __name__ == "__main__":
378 test_main() 385 test_main()
LEFTRIGHT

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