From fe09867a23afab467985080770fd7f984460aa69 2020-04-17 22:46:23 From: Ian Castleden Date: 2020-04-17 22:46:23 Subject: [PATCH] added documentation and test --- diff --git a/IPython/core/display.py b/IPython/core/display.py index 2b97bc6..a420993 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -752,6 +752,11 @@ class Latex(TextDisplayObject): class SVG(DisplayObject): + """Embed an SVG into the display. + + Note if you just want to view a svg image via a URL use `:class:Image` with + a url=URL keyword argument. + """ _read_flags = 'rb' # wrap data in a property, which extracts the tag, discarding diff --git a/IPython/core/tests/test_display.py b/IPython/core/tests/test_display.py index 0ce4ad2..bf44010 100644 --- a/IPython/core/tests/test_display.py +++ b/IPython/core/tests/test_display.py @@ -72,6 +72,12 @@ def test_retina_png(): nt.assert_equal(md['width'], 1) nt.assert_equal(md['height'], 1) +def test_embed_svg_url(): + # 6.1kB of data + url = "https://upload.wikimedia.org/wikipedia/commons/3/30/Vector-based_example.svg" + svg = display.SVG(url=url) + nt.assert_true(svg._repr_svg_().startswith('