Skip to content

Commit

Permalink
Ensure ListPanel objects can be passed as keyword (#1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 17, 2020
1 parent a91f96d commit b5eca2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit b5eca2c

Please sign in to comment.