##// END OF EJS Templates
exclude 3.8...
Matthias Bussonnier -
Show More
@@ -2,6 +2,7 b''
2 """
2 """
3
3
4 import stack_data
4 import stack_data
5 import sys
5
6
6 SV_VERSION = tuple([int(x) for x in stack_data.__version__.split(".")[0:2]])
7 SV_VERSION = tuple([int(x) for x in stack_data.__version__.split(".")[0:2]])
7
8
@@ -165,92 +166,93 b' def doctest_tb_sysexit():'
165 """
166 """
166
167
167
168
168 if SV_VERSION < (0, 6):
169 if sys.version_info >= (3, 9):
169
170 if SV_VERSION < (0, 6):
170 def doctest_tb_sysexit_verbose_stack_data_05():
171
171 """
172 def doctest_tb_sysexit_verbose_stack_data_05():
172 In [18]: %run simpleerr.py exit
173 """
173 An exception has occurred, use %tb to see the full traceback.
174 In [18]: %run simpleerr.py exit
174 SystemExit: (1, 'Mode = exit')
175 An exception has occurred, use %tb to see the full traceback.
175
176 SystemExit: (1, 'Mode = exit')
176 In [19]: %run simpleerr.py exit 2
177
177 An exception has occurred, use %tb to see the full traceback.
178 In [19]: %run simpleerr.py exit 2
178 SystemExit: (2, 'Mode = exit')
179 An exception has occurred, use %tb to see the full traceback.
179
180 SystemExit: (2, 'Mode = exit')
180 In [23]: %xmode verbose
181
181 Exception reporting mode: Verbose
182 In [23]: %xmode verbose
182
183 Exception reporting mode: Verbose
183 In [24]: %tb
184
184 ---------------------------------------------------------------------------
185 In [24]: %tb
185 SystemExit Traceback (most recent call last)
186 ---------------------------------------------------------------------------
186 <BLANKLINE>
187 SystemExit Traceback (most recent call last)
187 ...
188 <BLANKLINE>
188 30 except IndexError:
189 ...
189 31 mode = 'div'
190 30 except IndexError:
190 ---> 33 bar(mode)
191 31 mode = 'div'
191 mode = 'exit'
192 ---> 33 bar(mode)
192 <BLANKLINE>
193 mode = 'exit'
193 ... in bar(mode='exit')
194 <BLANKLINE>
194 ... except:
195 ... in bar(mode='exit')
195 ... stat = 1
196 ... except:
196 ---> ... sysexit(stat, mode)
197 ... stat = 1
197 mode = 'exit'
198 ---> ... sysexit(stat, mode)
198 stat = 2
199 mode = 'exit'
199 ... else:
200 stat = 2
200 ... raise ValueError('Unknown mode')
201 ... else:
201 <BLANKLINE>
202 ... raise ValueError('Unknown mode')
202 ... in sysexit(stat=2, mode='exit')
203 <BLANKLINE>
203 10 def sysexit(stat, mode):
204 ... in sysexit(stat=2, mode='exit')
204 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
205 10 def sysexit(stat, mode):
205 stat = 2
206 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
206 <BLANKLINE>
207 stat = 2
207 SystemExit: (2, 'Mode = exit')
208 <BLANKLINE>
208 """
209 SystemExit: (2, 'Mode = exit')
209
210 """
210 else:
211
211 # currently the only difference is
212 else:
212 # + mode = 'exit'
213 # currently the only difference is
213
214 # + mode = 'exit'
214 def doctest_tb_sysexit_verbose_stack_data_06():
215
215 """
216 def doctest_tb_sysexit_verbose_stack_data_06():
216 In [18]: %run simpleerr.py exit
217 """
217 An exception has occurred, use %tb to see the full traceback.
218 In [18]: %run simpleerr.py exit
218 SystemExit: (1, 'Mode = exit')
219 An exception has occurred, use %tb to see the full traceback.
219
220 SystemExit: (1, 'Mode = exit')
220 In [19]: %run simpleerr.py exit 2
221
221 An exception has occurred, use %tb to see the full traceback.
222 In [19]: %run simpleerr.py exit 2
222 SystemExit: (2, 'Mode = exit')
223 An exception has occurred, use %tb to see the full traceback.
223
224 SystemExit: (2, 'Mode = exit')
224 In [23]: %xmode verbose
225
225 Exception reporting mode: Verbose
226 In [23]: %xmode verbose
226
227 Exception reporting mode: Verbose
227 In [24]: %tb
228
228 ---------------------------------------------------------------------------
229 In [24]: %tb
229 SystemExit Traceback (most recent call last)
230 ---------------------------------------------------------------------------
230 <BLANKLINE>
231 SystemExit Traceback (most recent call last)
231 ...
232 <BLANKLINE>
232 30 except IndexError:
233 ...
233 31 mode = 'div'
234 30 except IndexError:
234 ---> 33 bar(mode)
235 31 mode = 'div'
235 mode = 'exit'
236 ---> 33 bar(mode)
236 <BLANKLINE>
237 mode = 'exit'
237 ... in bar(mode='exit')
238 <BLANKLINE>
238 ... except:
239 ... in bar(mode='exit')
239 ... stat = 1
240 ... except:
240 ---> ... sysexit(stat, mode)
241 ... stat = 1
241 mode = 'exit'
242 ---> ... sysexit(stat, mode)
242 stat = 2
243 mode = 'exit'
243 ... else:
244 stat = 2
244 ... raise ValueError('Unknown mode')
245 ... else:
245 <BLANKLINE>
246 ... raise ValueError('Unknown mode')
246 ... in sysexit(stat=2, mode='exit')
247 <BLANKLINE>
247 10 def sysexit(stat, mode):
248 ... in sysexit(stat=2, mode='exit')
248 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
249 10 def sysexit(stat, mode):
249 stat = 2
250 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
250 mode = 'exit'
251 stat = 2
251 <BLANKLINE>
252 mode = 'exit'
252 SystemExit: (2, 'Mode = exit')
253 <BLANKLINE>
253 """
254 SystemExit: (2, 'Mode = exit')
255 """
254
256
255 def test_run_cell():
257 def test_run_cell():
256 import textwrap
258 import textwrap
General Comments 0
You need to be logged in to leave comments. Login now