File tree Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -642,15 +642,18 @@ def func():
642
642
2
643
643
except :
644
644
4
645
- finally :
645
+ else :
646
646
6
647
+ finally :
648
+ 8
647
649
648
650
self .run_and_compare (func ,
649
651
[(0 , 'call' ),
650
652
(1 , 'line' ),
651
653
(2 , 'line' ),
652
654
(6 , 'line' ),
653
- (6 , 'return' )])
655
+ (8 , 'line' ),
656
+ (8 , 'return' )])
654
657
655
658
def test_nested_loops (self ):
656
659
@@ -1016,6 +1019,47 @@ def func():
1016
1019
(3 , 'line' ),
1017
1020
(3 , 'return' )])
1018
1021
1022
+ def test_try_in_try_with_exception (self ):
1023
+
1024
+ def func ():
1025
+ try :
1026
+ try :
1027
+ raise TypeError
1028
+ except ValueError as ex :
1029
+ 5
1030
+ except TypeError :
1031
+ 7
1032
+
1033
+ self .run_and_compare (func ,
1034
+ [(0 , 'call' ),
1035
+ (1 , 'line' ),
1036
+ (2 , 'line' ),
1037
+ (3 , 'line' ),
1038
+ (3 , 'exception' ),
1039
+ (4 , 'line' ),
1040
+ (6 , 'line' ),
1041
+ (7 , 'line' ),
1042
+ (7 , 'return' )])
1043
+
1044
+ def func ():
1045
+ try :
1046
+ try :
1047
+ raise ValueError
1048
+ except ValueError as ex :
1049
+ 5
1050
+ except TypeError :
1051
+ 7
1052
+
1053
+ self .run_and_compare (func ,
1054
+ [(0 , 'call' ),
1055
+ (1 , 'line' ),
1056
+ (2 , 'line' ),
1057
+ (3 , 'line' ),
1058
+ (3 , 'exception' ),
1059
+ (4 , 'line' ),
1060
+ (5 , 'line' ),
1061
+ (5 , 'return' )])
1062
+
1019
1063
def test_if_in_if_in_if (self ):
1020
1064
def func (a = 0 , p = 1 , z = 1 ):
1021
1065
if p :
Original file line number Diff line number Diff line change 11
11
12
12
from test .tracedmodules import testmod
13
13
14
+ ##
15
+ ## See also test_sys_settrace.py, which contains tests that cover
16
+ ## tracing of many more code blocks.
17
+ ##
18
+
14
19
#------------------------------- Utilities -----------------------------------#
15
20
16
21
def fix_ext_py (filename ):
You can’t perform that action at this time.
0 commit comments