Skip to content

Commit

Permalink
Add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Jul 20, 2023
1 parent a51638d commit 7e4e0b8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion holoviews/tests/plotting/bokeh/test_plot.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import numpy as np
import pyviz_comms as comms

from param import concrete_descendents

from holoviews.core.element import Element
from holoviews.core.options import Store
from holoviews.element.comparison import ComparisonTestCase
from holoviews import Curve

from bokeh.models import (
ColumnDataSource, LinearColorMapper, LogColorMapper, HoverTool
ColumnDataSource, CustomJS, LinearColorMapper, LogColorMapper, HoverTool
)
from holoviews.plotting.bokeh.callbacks import Callback
from holoviews.plotting.bokeh.element import ElementPlot

bokeh_renderer = Store.renderers['bokeh']

from .. import option_intersections
Expand Down Expand Up @@ -76,3 +79,21 @@ def _test_hover_info(self, element, tooltips, line_policy='nearest', formatters=
print(renderers, hover)
for renderer in renderers:
self.assertTrue(any(renderer in h.renderers for h in hover))


def test_sync_legends():
curve = lambda i: Curve(np.arange(10) * i, label="ABC"[i])
plot1 = curve(0) * curve(1)
plot2 = curve(0) * curve(1) * curve(2)
combined_plot = plot1 + plot2

grid_bkplot = bokeh_renderer.get_plot(combined_plot).handles["plot"]
for p, *_ in grid_bkplot.children:
for r in p.renderers:
if r.name == "C":
assert r.js_property_callbacks == {}
else:
k, v = next(iter(r.js_property_callbacks.items()))
assert k == "change:muted"
assert isinstance(v[0], CustomJS)
assert v[0].code == "dst.muted = src.muted"

0 comments on commit 7e4e0b8

Please sign in to comment.