(*args, **kwargs)
| 84 | gzip_svg = gzip_svg.getvalue() |
| 85 | |
| 86 | def mocked_urlopen(*args, **kwargs): |
| 87 | class MockResponse: |
| 88 | def __init__(self, svg): |
| 89 | self._svg_data = svg |
| 90 | self.headers = {'content-type': 'image/svg+xml'} |
| 91 | |
| 92 | def read(self): |
| 93 | return self._svg_data |
| 94 | |
| 95 | if args[0] == url: |
| 96 | return MockResponse(svg_data) |
| 97 | elif args[0] == url + 'z': |
| 98 | ret= MockResponse(gzip_svg) |
| 99 | ret.headers['content-encoding']= 'gzip' |
| 100 | return ret |
| 101 | return MockResponse(None) |
| 102 | |
| 103 | with mock.patch('urllib.request.urlopen', side_effect=mocked_urlopen): |
| 104 | svg = display.SVG(url=url) |
nothing calls this directly
no test coverage detected