File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 2727from .base import NBClientTestsBase
2828
2929addr_pat = re .compile (r'0x[0-9a-f]{7,9}' )
30- ipython_input_pat = re .compile (r'<ipython-input-\d+-[0-9a-f]+>' )
3130current_dir = os .path .dirname (__file__ )
31+ ipython_input_pat = re .compile (r'<ipython-input-\d+-[0-9a-f]+>' )
32+ # Tracebacks look different in IPython 8,
33+ # see: https://github.com/ipython/ipython/blob/master/docs/source/whatsnew/version8.rst#traceback-improvements # noqa
34+ ipython8_input_pat = re .compile (r'Input In \[\d+\],' )
3235
3336
3437class AsyncMock (Mock ):
@@ -201,10 +204,11 @@ def normalize_output(output):
201204 if isinstance (value , string_types ):
202205 output ['data' ][key ] = normalize_base64 (value )
203206 if 'traceback' in output :
204- tb = [
205- re .sub (ipython_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
206- for line in output ['traceback' ]
207- ]
207+ tb = []
208+ for line in output ["traceback" ]:
209+ line = re .sub (ipython_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
210+ line = re .sub (ipython8_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
211+ tb .append (line )
208212 output ['traceback' ] = tb
209213
210214 return output
You can’t perform that action at this time.
0 commit comments