@@ -122,11 +122,6 @@ def test_default_units(self):
122122 assert isinstance (self .cc .default_units (["a" ], self .ax ), cat .UnitData )
123123
124124
125- @pytest .fixture
126- def ax ():
127- return plt .figure ().subplots ()
128-
129-
130125PLOT_LIST = [Axes .scatter , Axes .plot , Axes .bar ]
131126PLOT_IDS = ["scatter" , "plot" , "bar" ]
132127
@@ -139,7 +134,8 @@ def test_StrCategoryLocator(self):
139134 np .testing .assert_array_equal (ticks .tick_values (None , None ), locs )
140135
141136 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
142- def test_StrCategoryLocatorPlot (self , ax , plotter ):
137+ def test_StrCategoryLocatorPlot (self , plotter ):
138+ ax = plt .figure ().subplots ()
143139 plotter (ax , [1 , 2 , 3 ], ["a" , "b" , "c" ])
144140 np .testing .assert_array_equal (ax .yaxis .major .locator (), range (3 ))
145141
@@ -151,7 +147,7 @@ class TestStrCategoryFormatter:
151147 ids , cases = zip (* test_cases )
152148
153149 @pytest .mark .parametrize ("ydata" , cases , ids = ids )
154- def test_StrCategoryFormatter (self , ax , ydata ):
150+ def test_StrCategoryFormatter (self , ydata ):
155151 unit = cat .UnitData (ydata )
156152 labels = cat .StrCategoryFormatter (unit ._mapping )
157153 for i , d in enumerate (ydata ):
@@ -160,7 +156,8 @@ def test_StrCategoryFormatter(self, ax, ydata):
160156
161157 @pytest .mark .parametrize ("ydata" , cases , ids = ids )
162158 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
163- def test_StrCategoryFormatterPlot (self , ax , ydata , plotter ):
159+ def test_StrCategoryFormatterPlot (self , ydata , plotter ):
160+ ax = plt .figure ().subplots ()
164161 plotter (ax , range (len (ydata )), ydata )
165162 for i , d in enumerate (ydata ):
166163 assert ax .yaxis .major .formatter (i ) == d
@@ -186,7 +183,8 @@ class TestPlotBytes:
186183
187184 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
188185 @pytest .mark .parametrize ("bdata" , bytes_data , ids = bytes_ids )
189- def test_plot_bytes (self , ax , plotter , bdata ):
186+ def test_plot_bytes (self , plotter , bdata ):
187+ ax = plt .figure ().subplots ()
190188 counts = np .array ([4 , 6 , 5 ])
191189 plotter (ax , bdata , counts )
192190 axis_test (ax .xaxis , bdata )
@@ -201,15 +199,17 @@ class TestPlotNumlike:
201199
202200 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
203201 @pytest .mark .parametrize ("ndata" , numlike_data , ids = numlike_ids )
204- def test_plot_numlike (self , ax , plotter , ndata ):
202+ def test_plot_numlike (self , plotter , ndata ):
203+ ax = plt .figure ().subplots ()
205204 counts = np .array ([4 , 6 , 5 ])
206205 plotter (ax , ndata , counts )
207206 axis_test (ax .xaxis , ndata )
208207
209208
210209class TestPlotTypes :
211210 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
212- def test_plot_unicode (self , ax , plotter ):
211+ def test_plot_unicode (self , plotter ):
212+ ax = plt .figure ().subplots ()
213213 words = ['Здравствуйте' , 'привет' ]
214214 plotter (ax , words , [0 , 1 ])
215215 axis_test (ax .xaxis , words )
@@ -223,25 +223,29 @@ def test_data(self):
223223
224224 @pytest .mark .usefixtures ("test_data" )
225225 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
226- def test_plot_xaxis (self , ax , test_data , plotter ):
226+ def test_plot_xaxis (self , test_data , plotter ):
227+ ax = plt .figure ().subplots ()
227228 plotter (ax , self .x , self .xy )
228229 axis_test (ax .xaxis , self .x )
229230
230231 @pytest .mark .usefixtures ("test_data" )
231232 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
232- def test_plot_yaxis (self , ax , test_data , plotter ):
233+ def test_plot_yaxis (self , test_data , plotter ):
234+ ax = plt .figure ().subplots ()
233235 plotter (ax , self .yx , self .y )
234236 axis_test (ax .yaxis , self .y )
235237
236238 @pytest .mark .usefixtures ("test_data" )
237239 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
238- def test_plot_xyaxis (self , ax , test_data , plotter ):
240+ def test_plot_xyaxis (self , test_data , plotter ):
241+ ax = plt .figure ().subplots ()
239242 plotter (ax , self .x , self .y )
240243 axis_test (ax .xaxis , self .x )
241244 axis_test (ax .yaxis , self .y )
242245
243246 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
244- def test_update_plot (self , ax , plotter ):
247+ def test_update_plot (self , plotter ):
248+ ax = plt .figure ().subplots ()
245249 plotter (ax , ['a' , 'b' ], ['e' , 'g' ])
246250 plotter (ax , ['a' , 'b' , 'd' ], ['f' , 'a' , 'b' ])
247251 plotter (ax , ['b' , 'c' , 'd' ], ['g' , 'e' , 'd' ])
@@ -260,13 +264,15 @@ def test_update_plot(self, ax, plotter):
260264
261265 @pytest .mark .parametrize ("plotter" , plotters )
262266 @pytest .mark .parametrize ("xdata" , fvalues , ids = fids )
263- def test_mixed_type_exception (self , ax , plotter , xdata ):
267+ def test_mixed_type_exception (self , plotter , xdata ):
268+ ax = plt .figure ().subplots ()
264269 with pytest .raises (TypeError ):
265270 plotter (ax , xdata , [1 , 2 ])
266271
267272 @pytest .mark .parametrize ("plotter" , plotters )
268273 @pytest .mark .parametrize ("xdata" , fvalues , ids = fids )
269- def test_mixed_type_update_exception (self , ax , plotter , xdata ):
274+ def test_mixed_type_update_exception (self , plotter , xdata ):
275+ ax = plt .figure ().subplots ()
270276 with pytest .raises (TypeError ):
271277 plotter (ax , [0 , 3 ], [1 , 3 ])
272278 plotter (ax , xdata , [1 , 2 ])
0 commit comments