Compare 1526bb0 ... +0 ... 4e3439d

Coverage Reach
panel/tests/pane/test_holoviews.py panel/tests/pane/test_vtk.py panel/tests/pane/test_markup.py panel/tests/pane/test_plotly.py panel/tests/pane/test_deckgl.py panel/tests/pane/test_vega.py panel/tests/pane/test_image.py panel/tests/pane/test_plot.py panel/tests/pane/test_base.py panel/tests/pane/test_alert.py panel/tests/pane/test_ace.py panel/tests/pane/test_equation.py panel/tests/layout/test_tabs.py panel/tests/layout/test_base.py panel/tests/layout/test_grid.py panel/tests/layout/test_accordion.py panel/tests/layout/test_card.py panel/tests/layout/test_spacer.py panel/tests/widgets/test_select.py panel/tests/widgets/test_slider.py panel/tests/widgets/test_tables.py panel/tests/widgets/test_misc.py panel/tests/widgets/test_input.py panel/tests/widgets/test_file_selector.py panel/tests/widgets/test_base.py panel/tests/widgets/test_indicators.py panel/tests/widgets/test_button.py panel/tests/widgets/test_player.py panel/tests/widgets/test_ace.py panel/tests/test_param.py panel/tests/io/test_embed.py panel/tests/io/test_location.py panel/tests/io/test_notebook.py panel/tests/io/test_state.py panel/tests/io/test_model.py panel/tests/test_pipeline.py panel/tests/test_interact.py panel/tests/test_links.py panel/tests/test_config.py panel/tests/conftest.py panel/tests/test_reactive.py panel/tests/test_template.py panel/tests/test_server.py panel/tests/util.py panel/tests/models/test_location.py panel/tests/models/test_deckgl.py panel/tests/test_docs.py panel/tests/test_util.py panel/tests/test_viewable.py panel/tests/test_models.py panel/tests/test_cli.py panel/pane/vtk/synchronizable_serializer.py panel/pane/vtk/vtk.py panel/pane/vtk/synchronizable_deserializer.py panel/pane/vtk/enums.py panel/pane/vtk/__init__.py panel/pane/holoviews.py panel/pane/base.py panel/pane/plot.py panel/pane/markup.py panel/pane/plotly.py panel/pane/image.py panel/pane/deckgl.py panel/pane/vega.py panel/pane/media.py panel/pane/equation.py panel/pane/echarts.py panel/pane/streamz.py panel/pane/ipywidget.py panel/pane/ace.py panel/pane/alert.py panel/pane/__init__.py panel/widgets/select.py panel/widgets/indicators.py panel/widgets/slider.py panel/widgets/input.py panel/widgets/tables.py panel/widgets/misc.py panel/widgets/file_selector.py panel/widgets/base.py panel/widgets/button.py panel/widgets/player.py panel/widgets/ace.py panel/widgets/__init__.py panel/io/embed.py panel/io/server.py panel/io/state.py panel/io/notebook.py panel/io/location.py panel/io/rest.py panel/io/model.py panel/io/save.py panel/io/callbacks.py panel/io/resources.py panel/io/ipywidget.py panel/io/__init__.py panel/layout/base.py panel/layout/grid.py panel/layout/tabs.py panel/layout/accordion.py panel/layout/card.py panel/layout/spacer.py panel/layout/__init__.py panel/param.py panel/template/base.py panel/template/react/__init__.py panel/template/golden/__init__.py panel/template/theme.py panel/template/vanilla/__init__.py panel/template/bootstrap/__init__.py panel/template/material/__init__.py panel/template/__init__.py panel/pipeline.py panel/config.py panel/links.py panel/interact.py panel/models/widgets.py panel/models/vtk.py panel/models/plotly.py panel/models/deckgl.py panel/models/ace.py panel/models/comm_manager.py panel/models/layout.py panel/models/location.py panel/models/ipywidget.py panel/models/echarts.py panel/models/vega.py panel/models/markup.py panel/models/state.py panel/models/__init__.py panel/models/katex.py panel/models/mathjax.py panel/models/enums.py panel/reactive.py panel/auth.py panel/viewable.py panel/util.py panel/command/serve.py panel/command/__init__.py panel/command/oauth_secret.py panel/compiler.py panel/depends.py panel/__init__.py panel/__main__.py panel/callbacks.py setup.py dodo.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -98,7 +98,7 @@
Loading
98 98
    name = param.String(default='', doc="""
99 99
        Title of the pane.""")
100 100
101 -
    parameters = param.List(default=[], doc="""
101 +
    parameters = param.List(default=[], allow_None=True, doc="""
102 102
        If set this serves as a whitelist of parameters to display on
103 103
        the supplied Parameterized object.""")
104 104
@@ -154,8 +154,13 @@
Loading
154 154
            object = object.owner
155 155
        if isinstance(object, param.parameterized.Parameters):
156 156
            object = object.cls if object.self is None else object.self
157 +
157 158
        if 'parameters' not in params and object is not None:
158 159
            params['parameters'] = [p for p in object.param if p != 'name']
160 +
            self._explicit_parameters = False
161 +
        else:
162 +
            self._explicit_parameters = object is not None
163 +
159 164
        if object and 'name' not in params:
160 165
            params['name'] = param_name(object.name)
161 166
        super(Param, self).__init__(object, **params)
@@ -216,17 +221,28 @@
Loading
216 221
        for event in sorted(events, key=lambda x: x.name):
217 222
            if event.name == 'object':
218 223
                if isinstance(event.new, param.parameterized.Parameters):
224 +
                    # Setting object will trigger this method a second time
219 225
                    self.object = event.new.cls if event.new.self is None else event.new.self
220 226
                    return
221 -
                if event.new is None:
227 +
                
228 +
                if self._explicit_parameters:
229 +
                    parameters = self.parameters
230 +
                elif event.new is None:
222 231
                    parameters = []
223 232
                else:
224 233
                    parameters = [p for p in event.new.param if p != 'name']
225 234
                    self.name = param_name(event.new.name)
226 235
            if event.name == 'parameters':
227 -
                parameters = [] if event.new == [] else event.new
236 +
                if event.new is None:
237 +
                    self._explicit_parameters = False
238 +
                    if self.object is not None:
239 +
                        parameters = [p for p in self.object.param if p != 'name']
240 +
                else:
241 +
                    self._explicit_parameters = True
242 +
                    parameters = [] if event.new == [] else event.new
228 243
229 244
        if parameters != [] and parameters != self.parameters:
245 +
            # Setting parameters will trigger this method a second time
230 246
            self.parameters = parameters
231 247
            return
232 248

@@ -1097,3 +1097,34 @@
Loading
1097 1097
1098 1098
    assert test.a == 2
1099 1099
    del os.environ['PARAM_JSON_INIT']
1100 +
1101 +
def test_change_object_and_keep_parameters():
1102 +
    """Test that https://github.com/holoviz/panel/issues/1581 is solved"""
1103 +
    # Given
1104 +
    class TextModel(param.Parameterized):
1105 +
        text = param.String()
1106 +
        param2 = param.String()
1107 +
1108 +
    class TextView(param.Parameterized):
1109 +
        text = param.ClassSelector(class_=TextModel)
1110 +
        text_pane = param.Parameter()
1111 +
1112 +
        def __init__(self, **params):
1113 +
            params["text"] = TextModel(text="Original Text")
1114 +
            super().__init__(**params)
1115 +
1116 +
            self.text_pane = Param(
1117 +
                self.text, parameters=["text"]
1118 +
            )
1119 +
1120 +
        @param.depends("text", watch=True)
1121 +
        def _update_text_pane(self, *_):
1122 +
            self.text_pane.object = self.text
1123 +
1124 +
    view = TextView()
1125 +
    assert view.text_pane.parameters==["text"]
1126 +
1127 +
    # When
1128 +
    view.text = TextModel(text="New TextModel")
1129 +
    # Then
1130 +
    assert view.text_pane.parameters==["text"]

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
panel -<.01% 86.08%
dodo.py 0.00%
setup.py 0.00%
Project Totals (147 files) 85.68%
Loading