##// END OF EJS Templates
Backport PR #10896: Ensure that MimeBundleFormatter always returns a 2-tuple
Min RK -
Show More
@@ -217,7 +217,7 b' def catch_format_error(method, self, *args, **kwargs):'
217 r = method(self, *args, **kwargs)
217 r = method(self, *args, **kwargs)
218 except NotImplementedError:
218 except NotImplementedError:
219 # don't warn on NotImplementedErrors
219 # don't warn on NotImplementedErrors
220 return None
220 return self._check_return(None, args[0])
221 except Exception:
221 except Exception:
222 exc_info = sys.exc_info()
222 exc_info = sys.exc_info()
223 ip = get_ipython()
223 ip = get_ipython()
@@ -225,7 +225,7 b' def catch_format_error(method, self, *args, **kwargs):'
225 ip.showtraceback(exc_info)
225 ip.showtraceback(exc_info)
226 else:
226 else:
227 traceback.print_exception(*exc_info)
227 traceback.print_exception(*exc_info)
228 return None
228 return self._check_return(None, args[0])
229 return self._check_return(r, args[0])
229 return self._check_return(r, args[0])
230
230
231
231
@@ -521,3 +521,13 b' def test_repr_mime_meta():'
521 'height': 10,
521 'height': 10,
522 }
522 }
523 })
523 })
524
525 def test_repr_mime_failure():
526 class BadReprMime(object):
527 def _repr_mimebundle_(self, include=None, exclude=None):
528 raise RuntimeError
529
530 f = get_ipython().display_formatter
531 obj = BadReprMime()
532 d, md = f.format(obj)
533 nt.assert_in('text/plain', d)
General Comments 0
You need to be logged in to leave comments. Login now