Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 16, 2024
1 parent 1ce8ac6 commit fd09e2f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions holoviews/tests/element/test_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit fd09e2f

Please sign in to comment.