| 306 | |
| 307 | @parameterized.expand([('points', Points), ('scatter', Scatter)]) |
| 308 | def test_downsample_resample_when(self, kind, eltype): |
| 309 | df = pd.DataFrame( |
| 310 | np.random.multivariate_normal((0, 0), [[0.1, 0.1], [0.1, 1.0]], (5000,)) |
| 311 | ).rename({0: 'x', 1: 'y'}, axis=1) |
| 312 | dmap = df.hvplot(kind=kind, x='x', y='y', resample_when=1000, downsample=True) |
| 313 | assert isinstance(dmap, DynamicMap) |
| 314 | |
| 315 | render(dmap) # trigger dynamicmap |
| 316 | overlay = dmap.items()[0][1] |
| 317 | assert isinstance(overlay, Overlay) |
| 318 | |
| 319 | downsampled = overlay.get(0) |
| 320 | assert isinstance(downsampled, eltype) |
| 321 | assert len(downsampled) > 0 |
| 322 | |
| 323 | element = overlay.get(1) |
| 324 | assert isinstance(element, eltype) |
| 325 | assert len(element) == 0 |
| 326 | |
| 327 | def test_selector_error_if_no_datashading_operation(self): |
| 328 | with pytest.raises( |