##// END OF EJS Templates
Ensure that MimeBundleFormatter always returns a 2-tuple
Thomas Kluyver -
Show More
@@ -224,7 +224,7 b' def catch_format_error(method, self, *args, **kwargs):'
224 r = method(self, *args, **kwargs)
224 r = method(self, *args, **kwargs)
225 except NotImplementedError:
225 except NotImplementedError:
226 # don't warn on NotImplementedErrors
226 # don't warn on NotImplementedErrors
227 return None
227 return self._check_return(None, args[0])
228 except Exception:
228 except Exception:
229 exc_info = sys.exc_info()
229 exc_info = sys.exc_info()
230 ip = get_ipython()
230 ip = get_ipython()
@@ -232,7 +232,7 b' def catch_format_error(method, self, *args, **kwargs):'
232 ip.showtraceback(exc_info)
232 ip.showtraceback(exc_info)
233 else:
233 else:
234 traceback.print_exception(*exc_info)
234 traceback.print_exception(*exc_info)
235 return None
235 return self._check_return(None, args[0])
236 return self._check_return(r, args[0])
236 return self._check_return(r, args[0])
237
237
238
238
@@ -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