diff options
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 340f37f..50b5672 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -810,6 +810,70 @@ class TraceTestCase(unittest.TestCase): (6, 'line'), (6, 'return')]) + def test_break_to_continue1(self): + + def func(): + TRUE = 1 + x = [1] + while x: + x.pop() + while TRUE: + break + continue + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (6, 'line'), + (7, 'line'), + (3, 'line'), + (3, 'return')]) + + def test_break_to_continue2(self): + + def func(): + TRUE = 1 + x = [1] + while x: + x.pop() + while TRUE: + break + else: + continue + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (6, 'line'), + (3, 'line'), + (3, 'return')]) + + def test_break_to_break(self): + + def func(): + TRUE = 1 + while TRUE: + while TRUE: + break + break + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (5, 'return')]) + class SkipLineEventsTraceTestCase(TraceTestCase): """Repeat the trace tests, but with per-line events skipped""" |