##// END OF EJS Templates
add failing test for %tb after SyntaxError
MinRK -
Show More
@@ -9,6 +9,8 b' from __future__ import absolute_import'
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 import os
11 import os
12 import sys
13 from StringIO import StringIO
12
14
13 import nose.tools as nt
15 import nose.tools as nt
14
16
@@ -231,6 +233,23 b' def test_reset_in_length():'
231 def test_time():
233 def test_time():
232 _ip.magic('time None')
234 _ip.magic('time None')
233
235
236 def test_tb_syntaxerror():
237 """test %tb after a SyntaxError"""
238 ip = get_ipython()
239 ip.run_cell("for")
240
241 # trap and validate stdout
242 save_stdout = sys.stdout
243 try:
244 sys.stdout = StringIO()
245 ip.run_cell("%tb")
246 out = sys.stdout.getvalue()
247 finally:
248 sys.stdout = save_stdout
249 # trim output, and only check the last line
250 last_line = out.rstrip().splitlines()[-1].strip()
251 nt.assert_equals(last_line, "SyntaxError: invalid syntax")
252
234
253
235 @py3compat.doctest_refactor_print
254 @py3compat.doctest_refactor_print
236 def doctest_time():
255 def doctest_time():
General Comments 0
You need to be logged in to leave comments. Login now