From fd09e2fa9fbd717dcaaad3bf948d5b136ac6bc9b Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Wed, 16 Oct 2024 13:59:20 +0200 Subject: [PATCH] Add test --- holoviews/tests/element/test_selection.py | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/holoviews/tests/element/test_selection.py b/holoviews/tests/element/test_selection.py index 6c2e891019..05f8ff3418 100644 --- a/holoviews/tests/element/test_selection.py +++ b/holoviews/tests/element/test_selection.py @@ -30,6 +30,7 @@ ) from holoviews.element.comparison import ComparisonTestCase from holoviews.element.selection import spatial_select_columnar +from holoviews.util.transform import dim from ..utils import dask_switcher @@ -61,6 +62,29 @@ dd_available = pytest.mark.skipif(dd is None, reason='dask.dataframe not available') +class TestIndexExpr(ComparisonTestCase): + + def setUp(self): + import holoviews.plotting.bokeh # noqa + super().setUp() + self._backend = Store.current_backend + Store.set_current_backend('bokeh') + + def tearDown(self): + Store.current_backend = self._backend + + def test_index_selection_on_id_column(self): + # tests issue in https://github.com/holoviz/holoviews/pull/6336 + x, y = np.random.randn(2, 100) + idx = np.arange(100) + + points = Points( + {'x': x, 'y': y, 'id': idx}, kdims=['x', 'y'], vdims=['id'], datatype=['dataframe'] + ) + sel, _, _ = points._get_index_selection([3, 7], ['id']) + assert sel == dim('id').isin([3, 7]) + + class TestSelection1DExpr(ComparisonTestCase): def setUp(self):