1
- # TODO: matplotlib-build-wip
2
- from nose .plugins .attrib import attr
3
- from plotly .tools import _matplotlylib_imported
1
+ from ..exporter import Exporter
2
+ from ..renderers import FakeRenderer , FullFakeRenderer
4
3
5
- if _matplotlylib_imported :
6
- from .. exporter import Exporter
7
- from .. renderers import FakeRenderer , FullFakeRenderer
4
+ import matplotlib
5
+ matplotlib . use ( 'Agg' )
6
+ import matplotlib . pyplot as plt
8
7
9
- import matplotlib
10
- matplotlib .use ('Agg' )
11
- import matplotlib .pyplot as plt
8
+ import numpy as np
9
+ from numpy .testing import assert_warns
12
10
13
- import numpy as np
14
- from numpy .testing import assert_warns
15
11
16
-
17
- @attr ('matplotlib' )
18
12
def fake_renderer_output (fig , Renderer ):
19
13
renderer = Renderer ()
20
14
exporter = Exporter (renderer )
21
15
exporter .run (fig )
22
16
return renderer .output
23
17
24
18
25
- @attr ('matplotlib' )
26
19
def _assert_output_equal (text1 , text2 ):
27
20
for line1 , line2 in zip (text1 .strip ().split (), text2 .strip ().split ()):
28
21
assert line1 == line2
29
22
30
23
31
- @attr ('matplotlib' )
32
24
def test_lines ():
33
25
fig , ax = plt .subplots ()
34
26
ax .plot (range (20 ), '-k' )
@@ -52,7 +44,6 @@ def test_lines():
52
44
""" )
53
45
54
46
55
- @attr ('matplotlib' )
56
47
def test_markers ():
57
48
fig , ax = plt .subplots ()
58
49
ax .plot (range (2 ), 'ok' )
@@ -77,7 +68,6 @@ def test_markers():
77
68
""" )
78
69
79
70
80
- @attr ('matplotlib' )
81
71
def test_path_collection ():
82
72
fig , ax = plt .subplots ()
83
73
ax .scatter (range (3 ), range (3 ))
@@ -103,7 +93,6 @@ def test_path_collection():
103
93
""" )
104
94
105
95
106
- @attr ('matplotlib' )
107
96
def test_text ():
108
97
fig , ax = plt .subplots ()
109
98
ax .set_xlabel ("my x label" )
@@ -124,7 +113,6 @@ def test_text():
124
113
""" )
125
114
126
115
127
- @attr ('matplotlib' )
128
116
def test_path ():
129
117
fig , ax = plt .subplots ()
130
118
ax .add_patch (plt .Circle ((0 , 0 ), 1 ))
@@ -141,7 +129,6 @@ def test_path():
141
129
""" )
142
130
143
131
144
- @attr ('matplotlib' )
145
132
def test_multiaxes ():
146
133
fig , ax = plt .subplots (2 )
147
134
ax [0 ].plot (range (4 ))
@@ -160,7 +147,6 @@ def test_multiaxes():
160
147
""" )
161
148
162
149
163
- @attr ('matplotlib' )
164
150
def test_image ():
165
151
np .random .seed (0 ) # image size depends on the seed
166
152
fig , ax = plt .subplots ()
@@ -177,7 +163,6 @@ def test_image():
177
163
""" )
178
164
179
165
180
- @attr ('matplotlib' )
181
166
def test_legend ():
182
167
fig , ax = plt .subplots ()
183
168
ax .plot ([1 ,2 ,3 ], label = 'label' )
@@ -193,8 +178,6 @@ def test_legend():
193
178
closing figure
194
179
""" )
195
180
196
-
197
- @attr ('matplotlib' )
198
181
def test_legend_dots ():
199
182
fig , ax = plt .subplots ()
200
183
ax .plot ([1 ,2 ,3 ], label = 'label' )
@@ -217,9 +200,8 @@ def test_legend_dots():
217
200
closing figure
218
201
""" )
219
202
220
-
221
- @attr ('matplotlib' )
222
203
def test_blended ():
223
204
fig , ax = plt .subplots ()
224
205
ax .axvline (0 )
225
206
assert_warns (UserWarning , fake_renderer_output , fig , FakeRenderer )
207
+
0 commit comments