MCPcopy Create free account
hub / github.com/ipython/ipython / test_repr_mime_meta

Function test_repr_mime_meta

IPython/core/tests/test_formatters.py:500–523  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

498
499
500def test_repr_mime_meta():
501 class HasReprMimeMeta(object):
502 def _repr_mimebundle_(self, include=None, exclude=None):
503 data = {
504 'image/png': 'base64-image-data',
505 }
506 metadata = {
507 'image/png': {
508 'width': 5,
509 'height': 10,
510 }
511 }
512 return (data, metadata)
513
514 f = get_ipython().display_formatter
515 obj = HasReprMimeMeta()
516 d, md = f.format(obj)
517 nt.assert_equal(sorted(d), ['image/png', 'text/plain'])
518 nt.assert_equal(md, {
519 'image/png': {
520 'width': 5,
521 'height': 10,
522 }
523 })
524
525def test_repr_mime_failure():
526 class BadReprMime(object):

Callers

nothing calls this directly

Calls 3

get_ipythonFunction · 0.90
HasReprMimeMetaClass · 0.85
formatMethod · 0.45

Tested by

no test coverage detected