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 cloning of NamedListLike objects #7769

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions panel/layout/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,11 +719,11 @@ def clone(self, *objects: Any, **params: Any) -> NamedListLike:
"""
if objects:
overrides = objects
elif 'objects' in params:
raise ValueError(
'Tabs objects should be supplied either as positional '
'arguments or as a keyword, not both.'
)
if 'objects' in params:
raise ValueError(
'Tabs objects should be supplied either as positional '
'arguments or as a keyword, not both.'
)
elif 'objects' in params:
overrides = params.pop('objects')
else:
Expand Down
6 changes: 3 additions & 3 deletions panel/tests/layout/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_layout_radd_list(panel, document, comm):
assert model.children == [div3, div4, div1, div2]


@pytest.mark.parametrize('panel', [Column, Row])
@pytest.mark.parametrize('panel', [Column, Row, Accordion, Tabs])
def test_layout_add_error(panel, document, comm):
div1 = Div()
div2 = Div()
Expand Down Expand Up @@ -388,7 +388,7 @@ def test_layout_clear(panel, document, comm):
assert p1._models == p2._models == {}


@pytest.mark.parametrize('panel', [Column, Row])
@pytest.mark.parametrize('panel', [Column, Row, Accordion, Tabs])
def test_layout_clone_args(panel):
div1 = Div()
div2 = Div()
Expand All @@ -399,7 +399,7 @@ def test_layout_clone_args(panel):
assert layout.objects[1].object is clone.objects[0].object


@pytest.mark.parametrize('panel', [Column, Row])
@pytest.mark.parametrize('panel', [Column, Row, Accordion, Tabs])
def test_layout_clone_kwargs(panel):
div1 = Div()
div2 = Div()
Expand Down
Loading