##// END OF EJS Templates
added documentation and test
Ian Castleden -
Show More
@@ -752,6 +752,11 b' class Latex(TextDisplayObject):'
752
752
753
753
754 class SVG(DisplayObject):
754 class SVG(DisplayObject):
755 """Embed an SVG into the display.
756
757 Note if you just want to view a svg image via a URL use `:class:Image` with
758 a url=URL keyword argument.
759 """
755
760
756 _read_flags = 'rb'
761 _read_flags = 'rb'
757 # wrap data in a property, which extracts the <svg> tag, discarding
762 # wrap data in a property, which extracts the <svg> tag, discarding
@@ -72,6 +72,12 b' def test_retina_png():'
72 nt.assert_equal(md['width'], 1)
72 nt.assert_equal(md['width'], 1)
73 nt.assert_equal(md['height'], 1)
73 nt.assert_equal(md['height'], 1)
74
74
75 def test_embed_svg_url():
76 # 6.1kB of data
77 url = "https://upload.wikimedia.org/wikipedia/commons/3/30/Vector-based_example.svg"
78 svg = display.SVG(url=url)
79 nt.assert_true(svg._repr_svg_().startswith('<svg '))
80
75 def test_retina_jpeg():
81 def test_retina_jpeg():
76 here = os.path.dirname(__file__)
82 here = os.path.dirname(__file__)
77 img = display.Image(os.path.join(here, "2x2.jpg"), retina=True)
83 img = display.Image(os.path.join(here, "2x2.jpg"), retina=True)
General Comments 0
You need to be logged in to leave comments. Login now