##// END OF EJS Templates
Merge pull request #13804 from Carreau/sd-x...
Matthias Bussonnier -
r27865:25ded577 merge
parent child Browse files
Show More
@@ -1,15 +1,11 b''
1 """Tests for the key interactiveshell module, where the main ipython class is defined.
1 """Tests for the key interactiveshell module, where the main ipython class is defined.
2 """
2 """
3 #-----------------------------------------------------------------------------
4 # Module imports
5 #-----------------------------------------------------------------------------
6
3
4 import stack_data
5 import sys
7
6
8 # our own packages
7 SV_VERSION = tuple([int(x) for x in stack_data.__version__.split(".")[0:2]])
9
8
10 #-----------------------------------------------------------------------------
11 # Test functions
12 #-----------------------------------------------------------------------------
13
9
14 def test_reset():
10 def test_reset():
15 """reset must clear most namespaces."""
11 """reset must clear most namespaces."""
@@ -170,46 +166,93 b' def doctest_tb_sysexit():'
170 """
166 """
171
167
172
168
173 def doctest_tb_sysexit_verbose():
169 if sys.version_info >= (3, 9):
174 """
170 if SV_VERSION < (0, 6):
175 In [18]: %run simpleerr.py exit
171
176 An exception has occurred, use %tb to see the full traceback.
172 def doctest_tb_sysexit_verbose_stack_data_05():
177 SystemExit: (1, 'Mode = exit')
173 """
178
174 In [18]: %run simpleerr.py exit
179 In [19]: %run simpleerr.py exit 2
175 An exception has occurred, use %tb to see the full traceback.
180 An exception has occurred, use %tb to see the full traceback.
176 SystemExit: (1, 'Mode = exit')
181 SystemExit: (2, 'Mode = exit')
177
182
178 In [19]: %run simpleerr.py exit 2
183 In [23]: %xmode verbose
179 An exception has occurred, use %tb to see the full traceback.
184 Exception reporting mode: Verbose
180 SystemExit: (2, 'Mode = exit')
185
181
186 In [24]: %tb
182 In [23]: %xmode verbose
187 ---------------------------------------------------------------------------
183 Exception reporting mode: Verbose
188 SystemExit Traceback (most recent call last)
184
189 <BLANKLINE>
185 In [24]: %tb
190 ...
186 ---------------------------------------------------------------------------
191 30 except IndexError:
187 SystemExit Traceback (most recent call last)
192 31 mode = 'div'
188 <BLANKLINE>
193 ---> 33 bar(mode)
189 ...
194 mode = 'exit'
190 30 except IndexError:
195 <BLANKLINE>
191 31 mode = 'div'
196 ... in bar(mode='exit')
192 ---> 33 bar(mode)
197 ... except:
193 mode = 'exit'
198 ... stat = 1
194 <BLANKLINE>
199 ---> ... sysexit(stat, mode)
195 ... in bar(mode='exit')
200 mode = 'exit'
196 ... except:
201 stat = 2
197 ... stat = 1
202 ... else:
198 ---> ... sysexit(stat, mode)
203 ... raise ValueError('Unknown mode')
199 mode = 'exit'
204 <BLANKLINE>
200 stat = 2
205 ... in sysexit(stat=2, mode='exit')
201 ... else:
206 10 def sysexit(stat, mode):
202 ... raise ValueError('Unknown mode')
207 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
203 <BLANKLINE>
208 stat = 2
204 ... in sysexit(stat=2, mode='exit')
209 <BLANKLINE>
205 10 def sysexit(stat, mode):
210 SystemExit: (2, 'Mode = exit')
206 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
211 """
207 stat = 2
212
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 """
213
256
214 def test_run_cell():
257 def test_run_cell():
215 import textwrap
258 import textwrap
General Comments 0
You need to be logged in to leave comments. Login now