##// END OF EJS Templates
update pylabtools test to use new print_figure
MinRK -
Show More
@@ -1,54 +1,54
1 1 """Tests for pylab tools module.
2 2 """
3 3 #-----------------------------------------------------------------------------
4 4 # Copyright (c) 2011, the IPython Development Team.
5 5 #
6 6 # Distributed under the terms of the Modified BSD License.
7 7 #
8 8 # The full license is in the file COPYING.txt, distributed with this software.
9 9 #-----------------------------------------------------------------------------
10 10
11 11 #-----------------------------------------------------------------------------
12 12 # Imports
13 13 #-----------------------------------------------------------------------------
14 14 from __future__ import print_function
15 15
16 16 # Stdlib imports
17 17
18 18 # Third-party imports
19 19 import matplotlib; matplotlib.use('Agg')
20 20 import nose.tools as nt
21 21
22 22 from matplotlib import pyplot as plt
23 23
24 24 # Our own imports
25 25 from IPython.testing import decorators as dec
26 26 from .. import pylabtools as pt
27 27
28 28 #-----------------------------------------------------------------------------
29 29 # Globals and constants
30 30 #-----------------------------------------------------------------------------
31 31
32 32 #-----------------------------------------------------------------------------
33 33 # Local utilities
34 34 #-----------------------------------------------------------------------------
35 35
36 36 #-----------------------------------------------------------------------------
37 37 # Classes and functions
38 38 #-----------------------------------------------------------------------------
39 39
40 40 @dec.parametric
41 41 def test_figure_to_svg():
42 42 # simple empty-figure test
43 43 fig = plt.figure()
44 yield nt.assert_equal(pt.figure_to_svg(fig), None)
44 yield nt.assert_equal(pt.print_figure(fig, 'svg'), None)
45 45
46 46 plt.close('all')
47 47
48 48 # simple check for at least svg-looking output
49 49 fig = plt.figure()
50 50 ax = fig.add_subplot(1,1,1)
51 51 ax.plot([1,2,3])
52 52 plt.draw()
53 svg = pt.figure_to_svg(fig)[:100].lower()
53 svg = pt.print_figure(fig, 'svg')[:100].lower()
54 54 yield nt.assert_true('doctype svg' in svg)
General Comments 0
You need to be logged in to leave comments. Login now