Debian Codegraph @

tests/data/cases/pep_654_style.py

raw
1 # flags: --minimum-version=3.11
2 try:
3 raise OSError("blah")
4 except * ExceptionGroup as e:
5 pass
6
7
8 try:
9 async with trio.open_nursery() as nursery:
10 # Make two concurrent calls to child()
11 nursery.start_soon(child)
12 nursery.start_soon(child)
13 except *ValueError:
14 pass
15
16 try:
17 try:
18 raise ValueError(42)
19 except:
20 try:
21 raise TypeError(int)
22 except *(Exception):
23 pass
24 1 / 0
25 except Exception as e:
26 exc = e
27
28 try:
29 try:
30 raise FalsyEG("eg", [TypeError(1), ValueError(2)])
31 except \
32 *TypeError as e:
33 tes = e
34 raise
35 except * ValueError as e:
36 ves = e
37 pass
38 except Exception as e:
39 exc = e
40
41 try:
42 try:
43 raise orig
44 except *(TypeError, ValueError, *OTHER_EXCEPTIONS) as e:
45 raise SyntaxError(3) from e
46 except BaseException as e:
47 exc = e
48
49 try:
50 try:
51 raise orig
52 except\
53 * OSError as e:
54 raise TypeError(3) from e
55 except ExceptionGroup as e:
56 exc = e
57
58 # output
59
60 try:
61 raise OSError("blah")
62 except* ExceptionGroup as e:
63 pass
64
65
66 try:
67 async with trio.open_nursery() as nursery:
68 # Make two concurrent calls to child()
69 nursery.start_soon(child)
70 nursery.start_soon(child)
71 except* ValueError:
72 pass
73
74 try:
75 try:
76 raise ValueError(42)
77 except:
78 try:
79 raise TypeError(int)
80 except* Exception:
81 pass
82 1 / 0
83 except Exception as e:
84 exc = e
85
86 try:
87 try:
88 raise FalsyEG("eg", [TypeError(1), ValueError(2)])
89 except* TypeError as e:
90 tes = e
91 raise
92 except* ValueError as e:
93 ves = e
94 pass
95 except Exception as e:
96 exc = e
97
98 try:
99 try:
100 raise orig
101 except* (TypeError, ValueError, *OTHER_EXCEPTIONS) as e:
102 raise SyntaxError(3) from e
103 except BaseException as e:
104 exc = e
105
106 try:
107 try:
108 raise orig
109 except* OSError as e:
110 raise TypeError(3) from e
111 except ExceptionGroup as e:
112 exc = e