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