@@ -27,7 +27,6 @@ def test_encoding_not_provided(): # TODO: move to the parse_chart tests
2727 chart_spec = alt .Chart (df ).mark_point ()
2828 with pytest .raises (ValueError ):
2929 chart = ChartMetadata (chart_spec )
30- # _convert(chart)
3130
3231def test_invalid_encodings ():
3332 chart_spec = alt .Chart (df ).encode (x2 = 'quant' ).mark_point ()
@@ -39,7 +38,6 @@ def test_invalid_encodings():
3938def test_invalid_temporal (): # TODO: move to parse_chart tests???
4039 chart = alt .Chart (df ).mark_point ().encode (alt .X ('quant:T' ))
4140 ChartMetadata (chart )
42- # _convert(chart)
4341
4442@pytest .mark .parametrize ('channel' , ['quant' , 'ord' , 'nom' ])
4543def test_convert_x_success (channel ):
@@ -58,7 +56,6 @@ def test_convert_x_success_temporal(column):
5856def test_convert_x_fail ():
5957 with pytest .raises (KeyError ):
6058 chart_spec = ChartMetadata (alt .Chart (df ).encode (x = 'b:N' ).mark_point ())
61- _convert (chart_spec )
6259
6360@pytest .mark .parametrize ('channel' , ['quant' , 'ord' , 'nom' ])
6461def test_convert_y_success (channel ):
@@ -75,7 +72,6 @@ def test_convert_y_success_temporal(column):
7572def test_convert_y_fail ():
7673 with pytest .raises (KeyError ):
7774 chart_spec = ChartMetadata (alt .Chart (df ).encode (y = 'b:N' ).mark_point ())
78- _convert (chart_spec )
7975
8076@pytest .mark .xfail (raises = ValueError , reason = "It doesn't make sense to have x2 and y2 on scatter plots" )
8177def test_quantitative_x2_y2 ():
@@ -105,10 +101,9 @@ def test_convert_color_success_temporal(column):
105101 mapping = _convert (chart )
106102 assert list (mapping ['c' ]) == list (mdates .date2num (df [column ].values ))
107103
108- def test_convert_color_fail (): # TODO: What is this covering?
104+ def test_convert_color_fail ():
109105 with pytest .raises (KeyError ):
110106 chart_spec = ChartMetadata (alt .Chart (df ).encode (color = 'b:N' ).mark_point ())
111- _convert (chart_spec )
112107
113108@pytest .mark .parametrize ('channel,type' , [('quant' , 'Q' ), ('ord' , 'O' )])
114109def test_convert_fill (channel , type ):
@@ -128,10 +123,9 @@ def test_convert_fill_success_temporal(column):
128123 assert list (mapping ['c' ]) == list (mdates .date2num (df [column ].values ))
129124
130125
131- def test_convert_fill_fail (): # TODO: what is this covering?
126+ def test_convert_fill_fail ():
132127 with pytest .raises (KeyError ):
133128 chart_spec = ChartMetadata (alt .Chart (df ).encode (fill = 'b:N' ).mark_point ())
134- _convert (chart_spec )
135129
136130@pytest .mark .xfail (raises = NotImplementedError , reason = "The marker argument in scatter() cannot take arrays" )
137131def test_quantitative_shape ():
@@ -141,13 +135,12 @@ def test_quantitative_shape():
141135@pytest .mark .xfail (raises = NotImplementedError , reason = "The marker argument in scatter() cannot take arrays" )
142136@pytest .mark .parametrize ("column" , ["years" , "months" , "days" , "hrs" , "combination" ])
143137def test_convert_shape_fail_temporal (column ):
144- chart = ChartMetadata ( alt .Chart (df ).mark_point ().encode (alt .Shape (column ) ))
145- mapping = _convert (chart )
138+ chart = alt .Chart (df ).mark_point ().encode (alt .Shape (column ))
139+ convert (chart )
146140
147141@pytest .mark .xfail (raises = NotImplementedError , reason = "Merge: the dtype for opacity isn't assumed to be quantitative" )
148142def test_quantitative_opacity_value ():
149143 chart = ChartMetadata (alt .Chart (df_quant ).mark_point ().encode (opacity = alt .value (.5 )))
150- mapping = _convert (chart )
151144
152145@pytest .mark .xfail (raises = NotImplementedError , reason = "The alpha argument in scatter() cannot take arrays" )
153146def test_quantitative_opacity_array ():
@@ -174,7 +167,6 @@ def test_convert_size_success_nominal():
174167def test_convert_size_fail ():
175168 with pytest .raises (KeyError ):
176169 chart_spec = ChartMetadata (alt .Chart (df ).encode (size = 'b:N' ).mark_point ())
177- _convert (chart_spec )
178170
179171@pytest .mark .xfail (raises = NotImplementedError , reason = "Dates would need to be normalized for the size." )
180172@pytest .mark .parametrize ("column" , ["years" , "months" , "days" , "hrs" , "combination" ])
@@ -201,12 +193,11 @@ def test_convert_stroke_fail_temporal(column):
201193def test_quantitative_x_count_y ():
202194 df_count = pd .DataFrame ({"a" : [1 , 1 , 2 , 3 , 5 ], "b" : [1.4 , 1.4 , 2.9 , 3.18 , 5.3 ]})
203195 chart = ChartMetadata (alt .Chart (df_count ).mark_point ().encode (alt .X ('a' ), alt .Y ('count()' )))
204- mapping = _convert ( chart )
196+
205197
206198@pytest .mark .xfail (raises = NotImplementedError , reason = "specifying timeUnit is not supported yet" )
207199def test_timeUnit ():
208200 chart = ChartMetadata (alt .Chart (df ).mark_point ().encode (alt .X ('date(combination)' )))
209- _convert (chart )
210201
211202# Plots
212203
@@ -279,7 +270,6 @@ def test_line_color(self):
279270 )
280271 fig , _ = convert (chart )
281272 return fig
282- # plt.show()
283273
284274 @pytest .mark .mpl_image_compare (baseline_dir = 'baseline_images/test_convert' )
285275 @pytest .mark .parametrize ('o' , ['d:Q' , 'c:O' , 'dates:T' ])
@@ -291,7 +281,6 @@ def test_line_opacity(self, o):
291281 )
292282 fig , ax = convert (chart )
293283 return fig
294- # plt.show()
295284
296285 @pytest .mark .mpl_image_compare (baseline_dir = 'baseline_images/test_convert' )
297286 @pytest .mark .parametrize ('c,o' , [('d:Q' , 'd:Q' ), ('c:N' , 'c:O' ), ('dates:T' , 'dates:T' )])
0 commit comments