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