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

Fix HoloViews.layout issue #6063

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions panel/tests/pane/test_holoviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,3 +743,30 @@ def test_holoviews_property_override(document, comm):

assert model.styles["background"] == 'red'
assert model.children[0].css_classes == ['test_class']

widget = pn.widgets.IntInput(value=1)
def _plot(value):
return hv.Curve(list(range(value)))
plot = pn.bind(_plot, widget)

@hv_available
def test_holoviews_layout_objects(document, comm):
Copy link
Collaborator Author

@MarcSkovMadsen MarcSkovMadsen Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the below test cases. Thanks.

If you agree that the layout should not contain the widget_layout when its empty. Then we should try to find fix.

The alternative would be to set visible=False dynamically on the widget_layout when it contains no objects.

If you know where the fix should be applied I would appreciate you tell me or implement the fix. I have spent some time without being able to identify the place. Thanks.

UPDATE: LOOKING AT THE HoloViews implementation I can see that I can't expect the widget layout to be in position 1. But I still need to know whether the layout objects should be updated or the widget_layout invisible.

"""The HoloViews.layout should dynamically adjust depending on whether the object
has widgets or not"""
pane = pn.pane.HoloViews(_plot(1))
assert len(pane.layout)==0
pn.pane.HoloViews.object=plot
assert len(pane.layout)==1
pn.pane.HoloViews.object=_plot(1)
assert len(pane.layout)==0

@hv_available
def test_holoviews_layout_objects_reversed(document, comm):
"""The HoloViews.layout should dynamically adjust depending on whether the object
has widgets or not"""
pane = pn.pane.HoloViews(plot)
assert len(pane.layout)==1
pn.pane.HoloViews.object=_plot(1)
assert len(pane.layout)==0
pn.pane.HoloViews.object=plot
assert len(pane.layout)==1
Loading