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 ListPanel objects can be passed as keyword #1502

Merged
merged 1 commit into from
Jul 27, 2020
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
2 changes: 2 additions & 0 deletions panel/layout/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ def __init__(self, *objects, **params):
"as positional arguments or as a keyword, "
"not both." % type(self).__name__)
params['objects'] = [panel(pane) for pane in objects]
elif 'objects' in params:
params['objects'] = [panel(pane) for pane in params['objects']]
super(Panel, self).__init__(**params)

def _process_param_change(self, params):
Expand Down
8 changes: 8 additions & 0 deletions panel/tests/layout/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ def test_layout_constructor(panel):
assert all(isinstance(p, Bokeh) for p in layout.objects)


@pytest.mark.parametrize('panel', [Card, Column, Row])
def test_layout_constructor_with_objects_param(panel):
div1 = Div()
div2 = Div()
layout = panel(objects=[div1, div2])
assert all(isinstance(p, Bokeh) for p in layout.objects)


@pytest.mark.parametrize('panel', [Column, Row])
def test_layout_add(panel, document, comm):
div1 = Div()
Expand Down