MCPcopy Index your code
hub / github.com/ipython/ipython / test_repr_mime_meta

Function test_repr_mime_meta

tests/test_formatters.py:560–583  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

558
559
560def test_repr_mime_meta():
561 class HasReprMimeMeta(object):
562 def _repr_mimebundle_(self, include=None, exclude=None):
563 data = {
564 "image/png": "base64-image-data",
565 }
566 metadata = {
567 "image/png": {
568 "width": 5,
569 "height": 10,
570 }
571 }
572 return (data, metadata)
573
574 f = get_ipython().display_formatter
575 obj = HasReprMimeMeta()
576 d, md = f.format(obj)
577 assert sorted(d) == ["image/png", "text/plain"]
578 assert md == {
579 "image/png": {
580 "width": 5,
581 "height": 10,
582 }
583 }
584
585
586def test_repr_mime_failure():

Callers

nothing calls this directly

Calls 3

get_ipythonFunction · 0.90
HasReprMimeMetaClass · 0.85
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…