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

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

Issue 602: range: lean and mean (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Left Patch Set: address more concerns Created 3 months, 3 weeks ago , Downloaded from: http://bugs.python.org/file10183/range_lean_and_mean5.patch
Right Patch Set: __len__ is back! Created 3 months, 3 weeks ago
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
LEFTRIGHT
1 # Testing the line trace facility. 1 # Testing the line trace facility.
2 2
3 from test import test_support 3 from test import test_support
4 import unittest 4 import unittest
5 import sys 5 import sys
6 import difflib 6 import difflib
7 7
8 # A very basic example. If this fails, we're in deep trouble. 8 # A very basic example. If this fails, we're in deep trouble.
9 def basic(): 9 def basic():
10 return 1 10 return 1
11 11
12 basic.events = [(0, 'call'), 12 basic.events = [(0, 'call'),
13 (1, 'line'), 13 (1, 'line'),
14 (1, 'return')] 14 (1, 'return')]
15 15
16 # Many of the tests below are tricky because they involve pass statements. 16 # Many of the tests below are tricky because they involve pass statements.
17 # If there is implicit control flow around a pass statement (in an except 17 # If there is implicit control flow around a pass statement (in an except
18 # clause or else caluse) under what conditions do you set a line number 18 # clause or else caluse) under what conditions do you set a line number
19 # following that clause? 19 # following that clause?
20 20
21 21
22 # The entire "while 0:" statement is optimized away. No code 22 # The entire "while 0:" statement is optimized away. No code
23 # exists for it, so the line numbers skip directly from "del x" 23 # exists for it, so the line numbers skip directly from "del x"
24 # to "x = 1". 24 # to "x = 1".
25 def arigo_example(): 25 def arigo_example():
26 x = 1 26 x = 1
27 del x 27 del x
28 while 0: 28 while 0:
29 pass 29 pass
30 x = 1 30 x = 1
31 31
32 arigo_example.events = [(0, 'call'), 32 arigo_example.events = [(0, 'call'),
33 (1, 'line'), 33 (1, 'line'),
34 (2, 'line'), 34 (2, 'line'),
35 (5, 'line'), 35 (5, 'line'),
36 (5, 'return')] 36 (5, 'return')]
37 37
38 # check that lines consisting of just one instruction get traced: 38 # check that lines consisting of just one instruction get traced:
39 def one_instr_line(): 39 def one_instr_line():
40 x = 1 40 x = 1
41 del x 41 del x
42 x = 1 42 x = 1
43 43
44 one_instr_line.events = [(0, 'call'), 44 one_instr_line.events = [(0, 'call'),
45 (1, 'line'), 45 (1, 'line'),
46 (2, 'line'), 46 (2, 'line'),
47 (3, 'line'), 47 (3, 'line'),
48 (3, 'return')] 48 (3, 'return')]
49 49
50 def no_pop_tops(): # 0 50 def no_pop_tops(): # 0
(...skipping 640 matching lines...) Show 10 above Show 10 below
691 self.compare_jump_output(func.output, output) 691 self.compare_jump_output(func.output, output)
692 692
693 def test_01_jump_simple_forwards(self): 693 def test_01_jump_simple_forwards(self):
694 self.run_test(jump_simple_forwards) 694 self.run_test(jump_simple_forwards)
695 def test_02_jump_simple_backwards(self): 695 def test_02_jump_simple_backwards(self):
696 self.run_test(jump_simple_backwards) 696 self.run_test(jump_simple_backwards)
697 def test_03_jump_out_of_block_forwards(self): 697 def test_03_jump_out_of_block_forwards(self):
698 self.run_test(jump_out_of_block_forwards) 698 self.run_test(jump_out_of_block_forwards)
699 def test_04_jump_out_of_block_backwards(self): 699 def test_04_jump_out_of_block_backwards(self):
700 self.run_test(jump_out_of_block_backwards) 700 self.run_test(jump_out_of_block_backwards)
701 def test_05_jump_to_codeless_line(self): 701 def test_05_jump_to_codeless_line(self):
702 self.run_test(jump_to_codeless_line) 702 self.run_test(jump_to_codeless_line)
703 def test_06_jump_to_same_line(self): 703 def test_06_jump_to_same_line(self):
704 self.run_test(jump_to_same_line) 704 self.run_test(jump_to_same_line)
705 def test_07_jump_in_nested_finally(self): 705 def test_07_jump_in_nested_finally(self):
706 self.run_test(jump_in_nested_finally) 706 self.run_test(jump_in_nested_finally)
707 def test_08_no_jump_too_far_forwards(self): 707 def test_08_no_jump_too_far_forwards(self):
708 self.run_test(no_jump_too_far_forwards) 708 self.run_test(no_jump_too_far_forwards)
709 def test_09_no_jump_too_far_backwards(self): 709 def test_09_no_jump_too_far_backwards(self):
710 self.run_test(no_jump_too_far_backwards) 710 self.run_test(no_jump_too_far_backwards)
711 def test_10_no_jump_to_except_1(self): 711 def test_10_no_jump_to_except_1(self):
712 self.run_test(no_jump_to_except_1) 712 self.run_test(no_jump_to_except_1)
713 def test_11_no_jump_to_except_2(self): 713 def test_11_no_jump_to_except_2(self):
714 self.run_test(no_jump_to_except_2) 714 self.run_test(no_jump_to_except_2)
715 def test_12_no_jump_to_except_3(self): 715 def test_12_no_jump_to_except_3(self):
716 self.run_test(no_jump_to_except_3) 716 self.run_test(no_jump_to_except_3)
717 def test_13_no_jump_to_except_4(self): 717 def test_13_no_jump_to_except_4(self):
718 self.run_test(no_jump_to_except_4) 718 self.run_test(no_jump_to_except_4)
719 def test_14_no_jump_forwards_into_block(self): 719 def test_14_no_jump_forwards_into_block(self):
720 self.run_test(no_jump_forwards_into_block) 720 self.run_test(no_jump_forwards_into_block)
721 def test_15_no_jump_backwards_into_block(self): 721 def test_15_no_jump_backwards_into_block(self):
722 self.run_test(no_jump_backwards_into_block) 722 self.run_test(no_jump_backwards_into_block)
723 def test_16_no_jump_into_finally_block(self): 723 def test_16_no_jump_into_finally_block(self):
724 self.run_test(no_jump_into_finally_block) 724 self.run_test(no_jump_into_finally_block)
725 def test_17_no_jump_out_of_finally_block(self): 725 def test_17_no_jump_out_of_finally_block(self):
726 self.run_test(no_jump_out_of_finally_block) 726 self.run_test(no_jump_out_of_finally_block)
727 def test_18_no_jump_to_non_integers(self): 727 def test_18_no_jump_to_non_integers(self):
728 self.run_test(no_jump_to_non_integers) 728 self.run_test(no_jump_to_non_integers)
729 def test_19_no_jump_without_trace_function(self): 729 def test_19_no_jump_without_trace_function(self):
730 no_jump_without_trace_function() 730 no_jump_without_trace_function()
731 731
732 def test_main(): 732 def test_main():
733 test_support.run_unittest( 733 test_support.run_unittest(
734 TraceTestCase, 734 TraceTestCase,
735 RaisingTraceFuncTestCase, 735 RaisingTraceFuncTestCase,
736 JumpTestCase 736 JumpTestCase
737 ) 737 )
738 738
739 if __name__ == "__main__": 739 if __name__ == "__main__":
740 test_main() 740 test_main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld r292