Skip to content

Commit 7102d49

Browse files
authored
Test suite hygiene (#1739)
1 parent d29f1ef commit 7102d49

11 files changed

Lines changed: 44 additions & 43 deletions

File tree

doc/gallery/interactivity/app_bind.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
"df = hvplot.sampledata.penguins(\"pandas\").dropna()\n",
2424
"\n",
2525
"species_widget = pn.widgets.Select(\n",
26-
" name='Species',\n",
26+
" label='Species',\n",
2727
" options=list(df['species'].unique()),\n",
2828
" width=200,\n",
2929
")\n",
3030
"\n",
3131
"mass_widget = pn.widgets.IntSlider(\n",
32-
" name='Min Body Mass (g)',\n",
32+
" label='Min Body Mass (g)',\n",
3333
" start=int(df['body_mass_g'].min()),\n",
3434
" end=int(df['body_mass_g'].max()),\n",
3535
" step=100,\n",

doc/gallery/interactivity/app_rx.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"df = pd.DataFrame({'x': x})\n",
2727
"\n",
2828
"amp_slider = pn.widgets.FloatSlider(\n",
29-
" name='Amplitude', start=-5.0, end=5.0,\n",
29+
" label='Amplitude', start=-5.0, end=5.0,\n",
3030
" step=0.1, value=1.0, width=200,\n",
3131
")\n",
3232
"freq_slider = pn.widgets.FloatSlider(\n",
33-
" name='Frequency', start=0.1, end=5.1,\n",
33+
" label='Frequency', start=0.1, end=5.1,\n",
3434
" step=0.1, value=1.0, width=200,\n",
3535
")\n",
3636
"\n",

doc/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ import hvplot.pandas
332332
import panel as pn
333333
from bokeh.sampledata.penguins import data as df
334334

335-
w_sex = pn.widgets.MultiSelect(name='Sex', value=['MALE'], options=['MALE', 'FEMALE'])
336-
w_body_mass = pn.widgets.FloatSlider(name='Min body mass', start=2700, end=6300, step=50)
335+
w_sex = pn.widgets.MultiSelect(label='Sex', value=['MALE'], options=['MALE', 'FEMALE'])
336+
w_body_mass = pn.widgets.FloatSlider(label='Min body mass', start=2700, end=6300, step=50)
337337

338338
dfi = df.interactive(loc='left')
339339
dfi.loc[(dfi['sex'].isin(w_sex)) & (dfi['body_mass_g'] > w_body_mass)]['bill_length_mm'].describe()
@@ -352,7 +352,7 @@ import hvplot.xarray
352352
import panel as pn
353353
import xarray as xr
354354

355-
w_time = pn.widgets.IntSlider(name='time', start=0, end=10)
355+
w_time = pn.widgets.IntSlider(label='time', start=0, end=10)
356356

357357
da = xr.tutorial.open_dataset('air_temperature').air
358358
da.interactive.isel(time=w_time).mean().item() - da.mean().item()
@@ -375,8 +375,8 @@ import panel as pn
375375
import xarray as xr
376376

377377
da = xr.tutorial.open_dataset('air_temperature').air
378-
w_quantile = pn.widgets.FloatSlider(name='quantile', start=0, end=1)
379-
w_time = pn.widgets.IntSlider(name='time', start=0, end=10)
378+
w_quantile = pn.widgets.FloatSlider(label='quantile', start=0, end=1)
379+
w_time = pn.widgets.IntSlider(label='time', start=0, end=10)
380380

381381
da.interactive(loc='left') \
382382
.isel(time=w_time) \

doc/tutorials/getting_started.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@
762762
"source": [
763763
"import panel as pn\n",
764764
"\n",
765-
"w_latitude = pn.widgets.DiscreteSlider(name='Latitude', options=list(air.lat.values))\n",
766-
"w_rolling_window = pn.widgets.RadioButtonGroup(name='Rolling window', options=['1D', '7D', '30D'])"
765+
"w_latitude = pn.widgets.DiscreteSlider(label='Latitude', options=list(air.lat.values))\n",
766+
"w_rolling_window = pn.widgets.RadioButtonGroup(label='Rolling window', options=['1D', '7D', '30D'])"
767767
]
768768
},
769769
{

doc/user_guide/Interactive.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"metadata": {},
7474
"outputs": [],
7575
"source": [
76-
"slider = pnw.IntSlider(name='time', start=0, end=10)\n",
76+
"slider = pnw.IntSlider(label='time', start=0, end=10)\n",
7777
"\n",
7878
"ds.air.interactive(width=800).isel(time=slider)"
7979
]
@@ -149,7 +149,7 @@
149149
"source": [
150150
"from bokeh import sampledata\n",
151151
"\n",
152-
"ticker = pn.widgets.Select(options=['AAPL', 'IBM', 'GOOG', 'MSFT'], name='Ticker')\n",
152+
"ticker = pn.widgets.Select(options=['AAPL', 'IBM', 'GOOG', 'MSFT'], label='Ticker')\n",
153153
"\n",
154154
"def stock_df(ticker):\n",
155155
" df = pd.DataFrame(getattr(sampledata.stocks, ticker))\n",
@@ -176,7 +176,7 @@
176176
"metadata": {},
177177
"outputs": [],
178178
"source": [
179-
"ticker = pn.widgets.Select(options=['AAPL', 'IBM', 'GOOG', 'MSFT'], name='Ticker')\n",
179+
"ticker = pn.widgets.Select(options=['AAPL', 'IBM', 'GOOG', 'MSFT'], label='Ticker')\n",
180180
"\n",
181181
"def stock_df(ticker):\n",
182182
" df = pd.DataFrame(getattr(sampledata.stocks, ticker))\n",
@@ -261,7 +261,7 @@
261261
"metadata": {},
262262
"outputs": [],
263263
"source": [
264-
"time = pnw.Player(name='time', start=0, end=10, loop_policy='loop', interval=100)\n",
264+
"time = pnw.Player(label='time', start=0, end=10, loop_policy='loop', interval=100)\n",
265265
"\n",
266266
"ds.air.interactive(loc='bottom').isel(time=time).plot()"
267267
]
@@ -286,7 +286,7 @@
286286
"metadata": {},
287287
"outputs": [],
288288
"source": [
289-
"slider = pnw.FloatSlider(name='quantile', start=0, end=1)\n",
289+
"slider = pnw.FloatSlider(label='quantile', start=0, end=1)\n",
290290
"\n",
291291
"ds.air.interactive.quantile(slider, dim='time').hvplot(data_aspect=1)"
292292
]
@@ -304,7 +304,7 @@
304304
"metadata": {},
305305
"outputs": [],
306306
"source": [
307-
"q = pnw.FloatSlider(name='quantile', start=0, end=1)\n",
307+
"q = pnw.FloatSlider(label='quantile', start=0, end=1)\n",
308308
"\n",
309309
"(ds.air.interactive(loc='left')\n",
310310
" .sel(time=pnw.DiscreteSlider)\n",
@@ -371,7 +371,7 @@
371371
"metadata": {},
372372
"outputs": [],
373373
"source": [
374-
"slider = pnw.IntSlider(name='time', start=0, end=10)\n",
374+
"slider = pnw.IntSlider(label='time', start=0, end=10)\n",
375375
"baseline = ds.air.mean().item()\n",
376376
"baseline"
377377
]
@@ -398,8 +398,8 @@
398398
"metadata": {},
399399
"outputs": [],
400400
"source": [
401-
"slider = pnw.IntSlider(name='time', start=0, end=10)\n",
402-
"offset = pnw.IntSlider(name='offset', start=0, end=500)\n",
401+
"slider = pnw.IntSlider(label='time', start=0, end=10)\n",
402+
"offset = pnw.IntSlider(label='offset', start=0, end=500)\n",
403403
"\n",
404404
"ds.air.interactive.isel(time=slider).mean().item() + offset"
405405
]

doc/user_guide/Widgets.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
"metadata": {},
104104
"outputs": [],
105105
"source": [
106-
"x = pn.widgets.Select(name='x', options=['sepal_width', 'petal_width'])\n",
107-
"y = pn.widgets.Select(name='y', options=['sepal_length', 'petal_length'])\n",
108-
"kind = pn.widgets.Select(name='kind', value='scatter', options=['bivariate', 'scatter'])\n",
106+
"x = pn.widgets.Select(label='x', options=['sepal_width', 'petal_width'])\n",
107+
"y = pn.widgets.Select(label='y', options=['sepal_length', 'petal_length'])\n",
108+
"kind = pn.widgets.Select(label='kind', value='scatter', options=['bivariate', 'scatter'])\n",
109109
"\n",
110110
"plot = flowers.hvplot(x=x, y=y, kind=kind, colorbar=False, width=600)\n",
111111
"pn.Row(pn.WidgetBox(x, y, kind), plot)"
@@ -126,10 +126,10 @@
126126
"metadata": {},
127127
"outputs": [],
128128
"source": [
129-
"x = pn.widgets.Select(name='x', options=['sepal_width', 'petal_width'])\n",
130-
"y = pn.widgets.Select(name='y', options=['sepal_length', 'petal_length'])\n",
131-
"kind = pn.widgets.Select(name='kind', value='scatter', options=['bivariate', 'scatter'])\n",
132-
"by_species = pn.widgets.Checkbox(name='By species')\n",
129+
"x = pn.widgets.Select(label='x', options=['sepal_width', 'petal_width'])\n",
130+
"y = pn.widgets.Select(label='y', options=['sepal_length', 'petal_length'])\n",
131+
"kind = pn.widgets.Select(label='kind', value='scatter', options=['bivariate', 'scatter'])\n",
132+
"by_species = pn.widgets.Checkbox(label='By species')\n",
133133
"color = pn.widgets.ColorPicker(value='#ff0000')\n",
134134
"\n",
135135
"@pn.depends(by_species, color)\n",

hvplot/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def bind(function, *args, **kwargs):
210210
>>> import hvplot
211211
>>> import panel as pn
212212
213-
>>> alpha = pn.widgets.FloatSlider(value=0.5, start=0, end=1.0, step=0.1, name="Alpha")
214-
>>> top = pn.widgets.RadioButtonGroup(value=10, options=[5, 10, 25], name="Top")
213+
>>> alpha = pn.widgets.FloatSlider(value=0.5, start=0, end=1.0, step=0.1, label="Alpha")
214+
>>> top = pn.widgets.RadioButtonGroup(value=10, options=[5, 10, 25], label="Top")
215215
>>> interactive_table = (
216216
... hvplot
217217
... .bind(algorithm, alpha=alpha)

hvplot/tests/testinteractive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ def test_interactive_pandas_dataframe_hvplot_accessor_dmap_kind_widget(df):
260260
def test_interactive_with_bound_function_calls():
261261
df = pd.DataFrame({'species': [1, 1, 1, 2, 2, 2], 'sex': 3 * ['MALE', 'FEMALE']})
262262

263-
w_species = pn.widgets.Select(name='Species', options=[1, 2])
264-
w_sex = pn.widgets.MultiSelect(name='Sex', value=['MALE'], options=['MALE', 'FEMALE'])
263+
w_species = pn.widgets.Select(label='Species', options=[1, 2])
264+
w_sex = pn.widgets.MultiSelect(label='Sex', value=['MALE'], options=['MALE', 'FEMALE'])
265265

266266
def load_data(species, watch=True):
267267
if watch:

hvplot/tests/testpanel.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def setUp(self):
3333
self.cols = list(self.flowers.columns[:-1])
3434

3535
def test_using_explicit_widgets_works(self):
36-
x = pn.widgets.Select(name='x', value='sepal_length', options=self.cols)
37-
y = pn.widgets.Select(name='y', value='sepal_width', options=self.cols)
38-
kind = pn.widgets.Select(name='kind', value='scatter', options=['bivariate', 'scatter'])
39-
by_species = pn.widgets.Checkbox(name='By species')
36+
x = pn.widgets.Select(label='x', value='sepal_length', options=self.cols)
37+
y = pn.widgets.Select(label='y', value='sepal_width', options=self.cols)
38+
kind = pn.widgets.Select(label='kind', value='scatter', options=['bivariate', 'scatter'])
39+
by_species = pn.widgets.Checkbox(label='By species')
4040
color = pn.widgets.ColorPicker(value='#ff0000')
4141

4242
@pn.depends(by_species.param.value, color.param.value)
@@ -53,8 +53,8 @@ def test_casting_widgets_to_different_classes(self):
5353
assert len(look_for_class(pane, pn.widgets.DiscreteSlider)) == 1
5454

5555
def test_using_explicit_widgets_with_groupby_does_not_raise_error(self):
56-
x = pn.widgets.Select(name='x', value='sepal_length', options=self.cols)
57-
y = pn.widgets.Select(name='y', value='sepal_width', options=self.cols)
56+
x = pn.widgets.Select(label='x', value='sepal_length', options=self.cols)
57+
y = pn.widgets.Select(label='y', value='sepal_width', options=self.cols)
5858

5959
pane = self.flowers.hvplot(x, y, groupby='species')
6060
assert isinstance(pane, pn.param.ParamFunction)

hvplot/tests/testutil.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ def test_dynamic_and_static(self):
202202

203203
x = 'sepal_width'
204204
y = pn.widgets.Select(
205-
name='y', value='sepal_length', options=['sepal_length', 'petal_length']
205+
label='y', value='sepal_length', options=['sepal_length', 'petal_length']
206206
)
207-
kind = pn.widgets.Select(name='kind', value='scatter', options=['bivariate', 'scatter'])
207+
kind = pn.widgets.Select(label='kind', value='scatter', options=['bivariate', 'scatter'])
208208

209209
dynamic, arg_deps, _arg_names = process_dynamic_args(x, y, kind)
210210
assert 'x' not in dynamic
@@ -230,7 +230,7 @@ def test_fn_kwds(self):
230230
x = 'sepal_length'
231231
y = 'sepal_width'
232232
kind = 'scatter'
233-
by_species = pn.widgets.Checkbox(name='By species')
233+
by_species = pn.widgets.Checkbox(label='By species')
234234
color = pn.widgets.ColorPicker(value='#ff0000')
235235

236236
@pn.depends(by_species.param.value, color.param.value)
@@ -255,7 +255,7 @@ def test_check_crs():
255255
@pytest.mark.parametrize(
256256
'input',
257257
[
258-
'+init=epsg:26911',
258+
'epsg:26911',
259259
'PlateCarree',
260260
'epsg:6933',
261261
6933,
@@ -290,7 +290,7 @@ def test_process_crs_pyproj_proj():
290290
4326,
291291
'epsg:4326',
292292
'EPSG: 4326',
293-
'+init=epsg:4326',
293+
'epsg:4326',
294294
# Created with pyproj.CRS("EPSG:4326").to_wkt()
295295
'GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]', # noqa: E501
296296
],
@@ -310,7 +310,7 @@ def test_process_crs_platecarree(input):
310310
3857,
311311
'epsg:3857',
312312
'EPSG: 3857',
313-
'+init=epsg:3857',
313+
'epsg:3857',
314314
'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]', # noqa: E501
315315
# Created with pyproj.CRS("EPSG:3857").to_wkt()
316316
'PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]]', # noqa: E501

0 commit comments

Comments
 (0)