13
13
14
14
skip_popup = pytest .mark .skipif (not bokeh34 , reason = "Pop ups needs Bokeh 3.4" )
15
15
16
+ @pytest .fixture
17
+ def points ():
18
+ rng = np .random .default_rng (10 )
19
+ return hv .Points (rng .normal (size = (1000 , 2 )))
16
20
17
21
@pytest .mark .usefixtures ("bokeh_backend" )
18
22
@pytest .mark .parametrize (
@@ -215,11 +219,10 @@ def popup_form(name):
215
219
216
220
@skip_popup
217
221
@pytest .mark .usefixtures ("bokeh_backend" )
218
- def test_stream_popup_none (serve_hv ):
222
+ def test_stream_popup_none (serve_hv , points ):
219
223
def popup_form (name ):
220
224
return
221
225
222
- points = hv .Points (np .random .randn (10 , 2 ))
223
226
hv .streams .Tap (source = points , popup = popup_form ("Tap" ))
224
227
225
228
page = serve_hv (points )
@@ -258,7 +261,7 @@ def popup_form(x, y):
258
261
259
262
@skip_popup
260
263
@pytest .mark .usefixtures ("bokeh_backend" )
261
- def test_stream_popup_visible (serve_hv ):
264
+ def test_stream_popup_visible (serve_hv , points ):
262
265
def popup_form (x , y ):
263
266
def hide (_ ):
264
267
col .visible = False
@@ -270,7 +273,7 @@ def hide(_):
270
273
col = pn .Column (button )
271
274
return col
272
275
273
- points = hv . Points ( np . random . randn ( 10 , 2 )) .opts (tools = ["tap" ])
276
+ points = points .opts (tools = ["tap" ])
274
277
hv .streams .Tap (source = points , popup = popup_form )
275
278
276
279
page = serve_hv (points )
@@ -292,11 +295,11 @@ def hide(_):
292
295
293
296
@skip_popup
294
297
@pytest .mark .usefixtures ("bokeh_backend" )
295
- def test_stream_popup_close_button (serve_hv ):
298
+ def test_stream_popup_close_button (serve_hv , points ):
296
299
def popup_form (x , y ):
297
300
return "Hello"
298
301
299
- points = hv . Points ( np . random . randn ( 10 , 2 )) .opts (tools = ["tap" , "box_select" ])
302
+ points = points .opts (tools = ["tap" , "box_select" ])
300
303
hv .streams .Tap (source = points , popup = popup_form )
301
304
hv .streams .BoundsXY (source = points , popup = popup_form )
302
305
@@ -314,8 +317,7 @@ def popup_form(x, y):
314
317
315
318
@skip_popup
316
319
@pytest .mark .usefixtures ("bokeh_backend" )
317
- def test_stream_popup_selection1d_undefined (serve_hv ):
318
- points = hv .Points (np .random .randn (10 , 2 ))
320
+ def test_stream_popup_selection1d_undefined (serve_hv , points ):
319
321
hv .streams .Selection1D (source = points )
320
322
321
323
page = serve_hv (points )
@@ -326,11 +328,11 @@ def test_stream_popup_selection1d_undefined(serve_hv):
326
328
327
329
@skip_popup
328
330
@pytest .mark .usefixtures ("bokeh_backend" )
329
- def test_stream_popup_selection1d_tap (serve_hv ):
331
+ def test_stream_popup_selection1d_tap (serve_hv , points ):
330
332
def popup_form (index ):
331
333
return "# Tap"
332
334
333
- points = hv . Points ( np . random . randn ( 1000 , 2 )) .opts (hit_dilation = 5 )
335
+ points = points .opts (hit_dilation = 5 )
334
336
hv .streams .Selection1D (source = points , popup = popup_form )
335
337
points .opts (tools = ["tap" ], active_tools = ["tap" ])
336
338
@@ -345,12 +347,11 @@ def popup_form(index):
345
347
346
348
@skip_popup
347
349
@pytest .mark .usefixtures ("bokeh_backend" )
348
- def test_stream_popup_selection1d_lasso_select (serve_hv ):
350
+ def test_stream_popup_selection1d_lasso_select (serve_hv , points ):
349
351
def popup_form (index ):
350
352
if index :
351
353
return f"# lasso\n { len (index )} "
352
354
353
- points = hv .Points (np .random .randn (1000 , 2 ))
354
355
hv .streams .Selection1D (source = points , popup = popup_form )
355
356
points .opts (tools = ["tap" , "lasso_select" ], active_tools = ["lasso_select" ])
356
357
0 commit comments