diff --git a/IPython/core/tests/test_display.py b/IPython/core/tests/test_display.py
index bf44010..04c9325 100644
--- a/IPython/core/tests/test_display.py
+++ b/IPython/core/tests/test_display.py
@@ -73,11 +73,44 @@ def test_retina_png():
nt.assert_equal(md['height'], 1)
def test_embed_svg_url():
- # 6.1kB of data
+ import gzip
+ from io import BytesIO
+ svg_data = b''
+ url = 'http://test.com/circle.svg'
+
+ gzip_svg = BytesIO()
+ with gzip.open(gzip_svg, 'wb') as fp:
+ fp.write(svg_data)
+ gzip_svg = gzip_svg.getvalue()
+
+ def mocked_urlopen(*args, **kwargs):
+ class MockResponse:
+ def __init__(self, svg):
+ self._svg_data = svg
+ self.headers = {'content-type': 'image/svg+xml'}
+
+ def read(self):
+ return self._svg_data
+
+ if args[0] == url:
+ return MockResponse(svg_data)
+ elif args[0] == url + 'z':
+ ret= MockResponse(gzip_svg)
+ ret.headers['content-encoding']= 'gzip'
+ return ret
+ return MockResponse(None)
+
+ with mock.patch('urllib.request.urlopen', side_effect=mocked_urlopen):
+ svg = display.SVG(url=url)
+ nt.assert_true(svg._repr_svg_().startswith('