##// END OF EJS Templates
attempt reformat
Matthias Bussonnier -
Show More
@@ -1,32 +1,33 b''
1 1 """Error script. DO NOT EDIT FURTHER! It will break exception doctests!!!"""
2 2 import sys
3 3
4 4 def div0():
5 5 "foo"
6 6 x = 1
7 7 y = 0
8 8 x/y
9 9
10 10 def sysexit(stat, mode):
11 raise SystemExit(stat, f'Mode = {mode}')
11 raise SystemExit(stat, f"Mode = {mode}")
12
12 13
13 14 def bar(mode):
14 15 "bar"
15 16 if mode=='div':
16 17 div0()
17 18 elif mode=='exit':
18 19 try:
19 20 stat = int(sys.argv[2])
20 21 except:
21 22 stat = 1
22 23 sysexit(stat, mode)
23 24 else:
24 25 raise ValueError('Unknown mode')
25 26
26 27 if __name__ == '__main__':
27 28 try:
28 29 mode = sys.argv[1]
29 30 except IndexError:
30 31 mode = 'div'
31 32
32 33 bar(mode)
General Comments 0
You need to be logged in to leave comments. Login now