| OLD | NEW |
| 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 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ireturn_example.events = [(0, 'call'), | 154 ireturn_example.events = [(0, 'call'), |
| 155 (1, 'line'), | 155 (1, 'line'), |
| 156 (2, 'line'), | 156 (2, 'line'), |
| 157 (3, 'line'), | 157 (3, 'line'), |
| 158 (4, 'line'), | 158 (4, 'line'), |
| 159 (6, 'line'), | 159 (6, 'line'), |
| 160 (6, 'return')] | 160 (6, 'return')] |
| 161 | 161 |
| 162 # Tight loop with while(1) example (SF #765624) | 162 # Tight loop with while(1) example (SF #765624) |
| 163 def tightloop_example(): | 163 def tightloop_example(): |
| 164 items = range(0, 3) | 164 items = list(range(0, 3)) |
| 165 try: | 165 try: |
| 166 i = 0 | 166 i = 0 |
| 167 while 1: | 167 while 1: |
| 168 b = items[i]; i+=1 | 168 b = items[i]; i+=1 |
| 169 except IndexError: | 169 except IndexError: |
| 170 pass | 170 pass |
| 171 | 171 |
| 172 tightloop_example.events = [(0, 'call'), | 172 tightloop_example.events = [(0, 'call'), |
| 173 (1, 'line'), | 173 (1, 'line'), |
| 174 (2, 'line'), | 174 (2, 'line'), |
| 175 (3, 'line'), | 175 (3, 'line'), |
| 176 (4, 'line'), | 176 (4, 'line'), |
| 177 (5, 'line'), | 177 (5, 'line'), |
| 178 (5, 'line'), | 178 (5, 'line'), |
| 179 (5, 'line'), | 179 (5, 'line'), |
| 180 (5, 'line'), | 180 (5, 'line'), |
| 181 (5, 'exception'), | 181 (5, 'exception'), |
| 182 (6, 'line'), | 182 (6, 'line'), |
| 183 (7, 'line'), | 183 (7, 'line'), |
| 184 (7, 'return')] | 184 (7, 'return')] |
| 185 | 185 |
| 186 def tighterloop_example(): | 186 def tighterloop_example(): |
| 187 items = range(1, 4) | 187 items = list(range(1, 4)) |
| 188 try: | 188 try: |
| 189 i = 0 | 189 i = 0 |
| 190 while 1: i = items[i] | 190 while 1: i = items[i] |
| 191 except IndexError: | 191 except IndexError: |
| 192 pass | 192 pass |
| 193 | 193 |
| 194 tighterloop_example.events = [(0, 'call'), | 194 tighterloop_example.events = [(0, 'call'), |
| 195 (1, 'line'), | 195 (1, 'line'), |
| 196 (2, 'line'), | 196 (2, 'line'), |
| 197 (3, 'line'), | 197 (3, 'line'), |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() |
| OLD | NEW |