subclass IPython.core.display HTML object for more flexibility.

By defining `_repr_*_` functions, IPython will just call these
functions when a non-HTML representation is required.
I think that checking the validity of the images should occur on plotly's
end - we should assume that the images are valid. Here, for this test,
maybe checking the content-type will test that the right call to the server
was made and returned.


On Tue, Aug 19, 2014 at 12:56 AM, Andrew <notifications@github.com> wrote:

> In plotly/tests/test_optional/test_ipython/test_embed.py:
>
> > +
> > +def png_worker(display_obj, results):
> > +    img = display_obj._repr_png_()
> > +    if imghdr.what('', img) == "png":
> > +        results["png"] = True
> > +
> > +
> > +def svg_worker(display_obj, results):
> > +    img = display_obj._repr_svg_()
> > +    if img[:4] == '<svg':
> > +        results["svg"] = True
> > +
> > +
> > +def pdf_worker(display_obj, results):
> > +    img = display_obj._repr_pdf_()
> > +    if img[:4] == '%PDF':
>
> ditto on pdf...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/plotly/python-api/pull/107/files#r16397156>.
>