Skip if PIL can't write JPEGs to BytesIO objects
()
| 41 | nt.assert_in(u'doctype svg', svg) |
| 42 | |
| 43 | def _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") |
| 57 | def test_figure_to_jpeg(): |
no test coverage detected