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