@@ -121,13 +121,15 @@ def test_axisinfo(self):
121121 def test_default_units (self ):
122122 assert isinstance (self .cc .default_units (["a" ], self .ax ), cat .UnitData )
123123
124+
124125@pytest .fixture
125126def ax ():
126127 return plt .figure ().subplots ()
127128
128129PLOT_LIST = [Axes .scatter , Axes .plot , Axes .bar ]
129130PLOT_IDS = ["scatter" , "plot" , "bar" ]
130131
132+
131133class TestStrCategoryLocator (object ):
132134 def test_StrCategoryLocator (self ):
133135 locs = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
@@ -152,14 +154,14 @@ def test_StrCategoryFormatter(self, ax, ydata):
152154 unit = cat .UnitData (ydata )
153155 labels = cat .StrCategoryFormatter (unit )
154156 for i , d in enumerate (ydata ):
155- assert labels (i , i ) == d
157+ assert labels (i , i ) == cat . to_str ( d )
156158
157159 @pytest .mark .parametrize ("ydata" , cases , ids = ids )
158160 @pytest .mark .parametrize ("plotter" , PLOT_LIST , ids = PLOT_IDS )
159161 def test_StrCategoryFormatterPlot (self , ax , ydata , plotter ):
160162 plotter (ax , range (len (ydata )), ydata )
161163 for i , d in enumerate (ydata ):
162- assert ax .yaxis .major .formatter (i , i ) == d
164+ assert ax .yaxis .major .formatter (i , i ) == cat . to_str ( d )
163165 assert ax .yaxis .major .formatter (i + 1 , i + 1 ) == ""
164166 assert ax .yaxis .major .formatter (0 , None ) == ""
165167
@@ -254,17 +256,18 @@ def test_update_plot(self, ax, plotter):
254256 PLOT_BROKEN_LIST = [Axes .scatter ,
255257 pytest .param (Axes .plot , marks = pytest .mark .xfail ),
256258 pytest .param (Axes .bar , marks = pytest .mark .xfail )]
259+
257260 PLOT_BROKEN_IDS = ["scatter" , "plot" , "bar" ]
258261
259262 @pytest .mark .parametrize ("plotter" , PLOT_BROKEN_LIST , ids = PLOT_BROKEN_IDS )
260263 @pytest .mark .parametrize ("xdata" , fvalues , ids = fids )
261- def test_plot_failures (self , ax , plotter , xdata ):
264+ def test_mixed_type_exception (self , ax , plotter , xdata ):
262265 with pytest .raises (TypeError ):
263266 plotter (ax , xdata , [1 , 2 ])
264267
265268 @pytest .mark .parametrize ("plotter" , PLOT_BROKEN_LIST , ids = PLOT_BROKEN_IDS )
266269 @pytest .mark .parametrize ("xdata" , fvalues , ids = fids )
267- def test_plot_failures_update (self , ax , plotter , xdata ):
270+ def test_mixed_type_update_exception (self , ax , plotter , xdata ):
268271 with pytest .raises (TypeError ):
269272 plotter (ax , [0 , 3 ], [1 , 3 ])
270273 plotter (ax , xdata , [1 , 2 ])
0 commit comments