MCPcopy Index your code
hub / github.com/ipython/ipython / _check_pil_jpeg_bytes

Function _check_pil_jpeg_bytes

tests/test_pylabtools.py:45–57  ·  view source on GitHub ↗

Skip if PIL can't write JPEGs to BytesIO objects

()

Source from the content-addressed store, hash-verified

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

Callers 1

test_figure_to_jpegFunction · 0.85

Calls 2

newMethod · 0.80
saveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…