From 0d9eb7efe77558d785c4830cafe4ed1f58f83493 Mon Sep 17 00:00:00 2001 From: Alexey Sukharevich Date: Tue, 11 Mar 2025 08:45:22 +0100 Subject: [PATCH 1/2] Fix cloning of NamedListLake objects Fixed an error where cloning with only the `object` keyword argument caused an exception. --- panel/layout/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/panel/layout/base.py b/panel/layout/base.py index 30931de79e..8c6f3eb0b6 100644 --- a/panel/layout/base.py +++ b/panel/layout/base.py @@ -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: From b5434fe7366f836f216e666f4996e20f3b8b5a12 Mon Sep 17 00:00:00 2001 From: Alexey Sukharevich Date: Wed, 12 Mar 2025 22:16:38 +0100 Subject: [PATCH 2/2] Add Tabs and Accordion to clone tests --- panel/tests/layout/test_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panel/tests/layout/test_base.py b/panel/tests/layout/test_base.py index 20097b282b..0044e04c7d 100644 --- a/panel/tests/layout/test_base.py +++ b/panel/tests/layout/test_base.py @@ -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() @@ -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() @@ -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()