Debian Codegraph @

test-data/unit/native-parser-python311.test

raw
1 [case testTryExceptStar]
2 try:
3 x
4 except* ValueError:
5 y
6 [out]
7 MypyFile:1(
8 TryStmt:1(
9 Block:2(
10 ExpressionStmt:2(
11 NameExpr(x)))
12 *
13 NameExpr(ValueError)
14 Block:4(
15 ExpressionStmt:4(
16 NameExpr(y)))))
17
18 [case testTryExceptStarWithVar]
19 try:
20 x
21 except* Exception as e:
22 y
23 [out]
24 MypyFile:1(
25 TryStmt:1(
26 Block:2(
27 ExpressionStmt:2(
28 NameExpr(x)))
29 *
30 NameExpr(Exception)
31 NameExpr(e)
32 Block:4(
33 ExpressionStmt:4(
34 NameExpr(y)))))
35
36 [case testTryMultipleExceptStar]
37 try:
38 x
39 except* ValueError:
40 y
41 except* KeyError as e:
42 z
43 [out]
44 MypyFile:1(
45 TryStmt:1(
46 Block:2(
47 ExpressionStmt:2(
48 NameExpr(x)))
49 *
50 NameExpr(ValueError)
51 Block:4(
52 ExpressionStmt:4(
53 NameExpr(y)))
54 NameExpr(KeyError)
55 NameExpr(e)
56 Block:6(
57 ExpressionStmt:6(
58 NameExpr(z)))))
59
60 [case testTryExceptStarElseFinally]
61 try:
62 x
63 except* ValueError:
64 y
65 else:
66 z
67 finally:
68 w
69 [out]
70 MypyFile:1(
71 TryStmt:1(
72 Block:2(
73 ExpressionStmt:2(
74 NameExpr(x)))
75 *
76 NameExpr(ValueError)
77 Block:4(
78 ExpressionStmt:4(
79 NameExpr(y)))
80 Else(
81 ExpressionStmt:6(
82 NameExpr(z)))
83 Finally(
84 ExpressionStmt:8(
85 NameExpr(w)))))
86
87 [case testUnpackTypeInSignature]
88 def f(*args: *Ts) -> None:
89 pass
90 [out]
91 MypyFile:1(
92 FuncDef:1(
93 f
94 def (*args: *Ts?) -> None?
95 VarArg(
96 Var(args))
97 Block:2(
98 PassStmt:2())))
99
100 [case testUnpackTypeInTuple]
101 x: tuple[int, *Ts, str]
102 [out]
103 MypyFile:1(
104 AssignmentStmt:1(
105 NameExpr(x)
106 TempNode:1(
107 Any)
108 tuple?[int?, *Ts?, str?]))