MCPcopy Create free account
hub / github.com/ipython/ipython / _check_pil_jpeg_bytes

Function _check_pil_jpeg_bytes

IPython/core/tests/test_pylabtools.py:43–54  ·  view source on GitHub ↗

Skip if PIL can't write JPEGs to BytesIO objects

()

Source from the content-addressed store, hash-verified

41 nt.assert_in(u'doctype svg', svg)
42
43def _check_pil_jpeg_bytes():
44 """Skip if PIL can't write JPEGs to BytesIO objects"""
45 # PIL's JPEG plugin can't write to BytesIO objects
46 # Pillow fixes this
47 from PIL import Image
48 buf = BytesIO()
49 img = Image.new("RGB", (4,4))
50 try:
51 img.save(buf, 'jpeg')
52 except Exception as e:
53 ename = e.__class__.__name__
54 raise SkipTest("PIL can't write JPEG to BytesIO: %s: %s" % (ename, e))
55
56@dec.skip_without("PIL.Image")
57def test_figure_to_jpeg():

Callers 1

test_figure_to_jpegFunction · 0.85

Calls 2

newMethod · 0.80
saveMethod · 0.80

Tested by

no test coverage detected