Show More
@@ -26,6 +26,8 import numpy as np | |||
|
26 | 26 | from IPython.core.interactiveshell import InteractiveShell |
|
27 | 27 | from .. import pylabtools as pt |
|
28 | 28 | |
|
29 | from IPython.testing import decorators as dec | |
|
30 | ||
|
29 | 31 | #----------------------------------------------------------------------------- |
|
30 | 32 | # Globals and constants |
|
31 | 33 | #----------------------------------------------------------------------------- |
@@ -53,18 +55,15 def test_figure_to_svg(): | |||
|
53 | 55 | svg = pt.print_figure(fig, 'svg')[:100].lower() |
|
54 | 56 | nt.assert_in(b'doctype svg', svg) |
|
55 | 57 | |
|
56 | try: | |
|
57 | from PIL import Image | |
|
58 | def test_figure_to_jpg(): | |
|
59 | # simple check for at least jpg-looking output | |
|
60 | fig = plt.figure() | |
|
61 | ax = fig.add_subplot(1,1,1) | |
|
62 | ax.plot([1,2,3]) | |
|
63 | plt.draw() | |
|
64 | jpg = pt.print_figure(fig, 'jpg')[:100].lower() | |
|
65 | assert jpg.startswith(b'\xff\xd8') | |
|
66 | except ImportError: | |
|
67 | pass | |
|
58 | @dec.skip_without("PIL.Image") | |
|
59 | def test_figure_to_jpg(): | |
|
60 | # simple check for at least jpg-looking output | |
|
61 | fig = plt.figure() | |
|
62 | ax = fig.add_subplot(1,1,1) | |
|
63 | ax.plot([1,2,3]) | |
|
64 | plt.draw() | |
|
65 | jpg = pt.print_figure(fig, 'jpg')[:100].lower() | |
|
66 | assert jpg.startswith(b'\xff\xd8') | |
|
68 | 67 | |
|
69 | 68 | |
|
70 | 69 | def test_import_pylab(): |
General Comments 0
You need to be logged in to leave comments.
Login now