diff --git a/holoviews/core/spaces.py b/holoviews/core/spaces.py index 6653bdc86b..ae99700b82 100644 --- a/holoviews/core/spaces.py +++ b/holoviews/core/spaces.py @@ -1,7 +1,7 @@ import itertools import types from collections import defaultdict -from contextlib import contextmanager +from contextlib import contextmanager, suppress from functools import partial from itertools import groupby from numbers import Number @@ -547,7 +547,10 @@ def __call__(self, *args, **kwargs): kwarg_hash = kwargs.pop('_memoization_hash_', ()) (self.args, self.kwargs) = (args, kwargs) if hasattr(self.callable, 'rx'): - return self.callable.rx.value + with suppress(TypeError): + # If param.bind is used and not all arguments are set + # it will raise TypeError + return self.callable.rx.value if not args and not kwargs and not any(kwarg_hash): return self.callable() inputs = [i for i in self.inputs if isinstance(i, DynamicMap)] streams = [] diff --git a/holoviews/tests/test_streams.py b/holoviews/tests/test_streams.py index 5870d03f1b..17cb93bc30 100644 --- a/holoviews/tests/test_streams.py +++ b/holoviews/tests/test_streams.py @@ -6,8 +6,10 @@ import pandas as pd import param +import pytest from panel.widgets import IntSlider +import holoviews as hv from holoviews.core.spaces import DynamicMap from holoviews.core.util import Version from holoviews.element import Curve, Histogram, Points, Polygons, Scatter @@ -595,6 +597,24 @@ def subscriber_y(**kwargs): self.assertEqual(values_y, [{}]) +@pytest.mark.usefixtures("bokeh_backend") +def test_dynamicmap_partial_bind_and_streams(): + # Ref: https://github.com/holoviz/holoviews/issues/6008 + + def make_plot(z, x_range, y_range): + return Curve([1, 2, 3, 4, z]) + + slider = IntSlider(name='Slider', start=0, end=10) + range_xy = RangeXY() + + dmap = DynamicMap(param.bind(make_plot, z=slider), streams=[range_xy]) + + bk_figure = hv.render(dmap) + + assert bk_figure.renderers[0].data_source.data["y"][-1] == 0 + assert range_xy.x_range == (0, 4) + assert range_xy.y_range == (-0.4, 4.4) + class TestSubscribers(ComparisonTestCase):