@@ -34,10 +34,20 @@ def _check_legend_labels(ax, labels):
3434 assert label == e
3535
3636
37- def test_series_hist_bins (scalars_dfs ):
37+ @pytest .mark .parametrize (
38+ ("alias" ),
39+ [
40+ pytest .param (True ),
41+ pytest .param (False ),
42+ ],
43+ )
44+ def test_series_hist_bins (scalars_dfs , alias ):
3845 scalars_df , scalars_pandas_df = scalars_dfs
3946 bins = 5
40- ax = scalars_df ["int64_col" ].plot .hist (bins = bins )
47+ if alias :
48+ ax = scalars_df ["int64_col" ].hist (bins = bins )
49+ else :
50+ ax = scalars_df ["int64_col" ].plot .hist (bins = bins )
4151 pd_ax = scalars_pandas_df ["int64_col" ].plot .hist (bins = bins )
4252
4353 # Compares axis values and height between bigframes and pandas histograms.
@@ -49,11 +59,21 @@ def test_series_hist_bins(scalars_dfs):
4959 assert ax .patches [i ]._height == pd_ax .patches [i ]._height
5060
5161
52- def test_dataframes_hist_bins (scalars_dfs ):
62+ @pytest .mark .parametrize (
63+ ("alias" ),
64+ [
65+ pytest .param (True ),
66+ pytest .param (False ),
67+ ],
68+ )
69+ def test_dataframes_hist_bins (scalars_dfs , alias ):
5370 scalars_df , scalars_pandas_df = scalars_dfs
5471 bins = 7
5572 columns = ["int64_col" , "int64_too" , "float64_col" ]
56- ax = scalars_df [columns ].plot .hist (bins = bins )
73+ if alias :
74+ ax = scalars_df [columns ].hist (bins = bins )
75+ else :
76+ ax = scalars_df [columns ].plot .hist (bins = bins )
5777 pd_ax = scalars_pandas_df [columns ].plot .hist (bins = bins )
5878
5979 # Compares axis values and height between bigframes and pandas histograms.
@@ -171,10 +191,25 @@ def test_hist_kwargs_ticks_props(scalars_dfs):
171191 tm .assert_almost_equal (ylabels [i ].get_rotation (), pd_ylables [i ].get_rotation ())
172192
173193
174- def test_line (scalars_dfs ):
194+ @pytest .mark .parametrize (
195+ ("col_names" , "alias" ),
196+ [
197+ pytest .param (
198+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], True , id = "df_alias"
199+ ),
200+ pytest .param (
201+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], False , id = "df"
202+ ),
203+ pytest .param (["int64_col" ], True , id = "series_alias" ),
204+ pytest .param (["int64_col" ], False , id = "series" ),
205+ ],
206+ )
207+ def test_line (scalars_dfs , col_names , alias ):
175208 scalars_df , scalars_pandas_df = scalars_dfs
176- col_names = ["int64_col" , "float64_col" , "int64_too" , "bool_col" ]
177- ax = scalars_df [col_names ].plot .line ()
209+ if alias :
210+ ax = scalars_df [col_names ].line ()
211+ else :
212+ ax = scalars_df [col_names ].plot .line ()
178213 pd_ax = scalars_pandas_df [col_names ].plot .line ()
179214 tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
180215 tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -183,10 +218,21 @@ def test_line(scalars_dfs):
183218 tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
184219
185220
186- def test_area (scalars_dfs ):
221+ @pytest .mark .parametrize (
222+ ("col_names" , "alias" ),
223+ [
224+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], True , id = "df_alias" ),
225+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], False , id = "df" ),
226+ pytest .param (["int64_col" ], True , id = "series_alias" ),
227+ pytest .param (["int64_col" ], False , id = "series" ),
228+ ],
229+ )
230+ def test_area (scalars_dfs , col_names , alias ):
187231 scalars_df , scalars_pandas_df = scalars_dfs
188- col_names = ["int64_col" , "float64_col" , "int64_too" ]
189- ax = scalars_df [col_names ].plot .area (stacked = False )
232+ if alias :
233+ ax = scalars_df [col_names ].area (stacked = False )
234+ else :
235+ ax = scalars_df [col_names ].plot .area (stacked = False )
190236 pd_ax = scalars_pandas_df [col_names ].plot .area (stacked = False )
191237 tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
192238 tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -195,10 +241,21 @@ def test_area(scalars_dfs):
195241 tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
196242
197243
198- def test_bar (scalars_dfs ):
244+ @pytest .mark .parametrize (
245+ ("col_names" , "alias" ),
246+ [
247+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], True , id = "df_alias" ),
248+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], False , id = "df" ),
249+ pytest .param (["int64_col" ], True , id = "series_alias" ),
250+ pytest .param (["int64_col" ], False , id = "series" ),
251+ ],
252+ )
253+ def test_bar (scalars_dfs , col_names , alias ):
199254 scalars_df , scalars_pandas_df = scalars_dfs
200- col_names = ["int64_col" , "float64_col" , "int64_too" ]
201- ax = scalars_df [col_names ].plot .bar ()
255+ if alias :
256+ ax = scalars_df [col_names ].bar ()
257+ else :
258+ ax = scalars_df [col_names ].plot .bar ()
202259 pd_ax = scalars_pandas_df [col_names ].plot .bar ()
203260 tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
204261 tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -207,10 +264,23 @@ def test_bar(scalars_dfs):
207264 tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
208265
209266
210- def test_scatter (scalars_dfs ):
267+ @pytest .mark .parametrize (
268+ ("col_names" , "alias" ),
269+ [
270+ pytest .param (
271+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], True , id = "df_alias"
272+ ),
273+ pytest .param (
274+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], False , id = "df"
275+ ),
276+ ],
277+ )
278+ def test_scatter (scalars_dfs , col_names , alias ):
211279 scalars_df , scalars_pandas_df = scalars_dfs
212- col_names = ["int64_col" , "float64_col" , "int64_too" , "bool_col" ]
213- ax = scalars_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
280+ if alias :
281+ ax = scalars_df [col_names ].scatter (x = "int64_col" , y = "float64_col" )
282+ else :
283+ ax = scalars_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
214284 pd_ax = scalars_pandas_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
215285 tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
216286 tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
0 commit comments