Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Compositor does not make superfluous copies #2194

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,10 @@ def map(cls, obj, mode='data', backend=None):
if overlay_compositors:
obj = obj.map(lambda obj: cls.collapse_element(obj, mode=mode, backend=backend),
[CompositeOverlay])
if element_compositors:
element_patterns = [c.pattern for c in element_compositors]
if element_compositors and obj.traverse(lambda x: x, element_patterns):
obj = obj.map(lambda obj: cls.collapse_element(obj, mode=mode, backend=backend),
[c.pattern for c in element_compositors])
element_patterns)
return obj


Expand Down
17 changes: 14 additions & 3 deletions tests/testbokehcallbacks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from unittest import SkipTest
from nose.plugins.attrib import attr

from holoviews.element.comparison import ComparisonTestCase
from holoviews.core import NdOverlay
from holoviews.core.options import Store

from holoviews.element import Curve
from holoviews.element.comparison import ComparisonTestCase
from holoviews.streams import Selection1D

try:
from holoviews.plotting.bokeh.callbacks import Callback
from holoviews.plotting.bokeh.callbacks import Callback, Selection1DCallback
from holoviews.plotting.bokeh.util import bokeh_version

from bokeh.events import Tap
Expand Down Expand Up @@ -52,6 +54,15 @@ def test_customjs_callback_attributes_js_for_cb_data(self):
'data["y1"] = cb_data["geometry"]["y1"];\n')
self.assertEqual(js_code, code)


def test_callback_on_ndoverlay_is_attached(self):
ndoverlay = NdOverlay({i: Curve([i]) for i in range(5)})
selection = Selection1D(source=ndoverlay)
plot = bokeh_renderer.get_plot(ndoverlay)
self.assertEqual(len(plot.callbacks), 1)
self.assertIsInstance(plot.callbacks[0], Selection1DCallback)


@attr(optional=1)
class TestBokehServerJSCallbacks(ComparisonTestCase):

Expand Down