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

Value none param mapping #7639

Open
wants to merge 3 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
2 changes: 1 addition & 1 deletion panel/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def widget(self, p_name):
kw['start'] = bounds[0]
if bounds[1] is not None:
kw['end'] = bounds[1]
if (('start' not in kw or 'end' not in kw) and
if (('start' not in kw or 'end' not in kw or value is None) and
not isinstance(p_obj, (param.Date, param.CalendarDate))):
# Do not change widget class if mapping was overridden
if not widget_class_overridden:
Expand Down
14 changes: 12 additions & 2 deletions panel/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from bokeh.models import (
AutocompleteInput as BkAutocompleteInput, Button as BkButton,
Checkbox as BkCheckbox, Column as BkColumn, Div, MultiSelect,
RangeSlider as BkRangeSlider, Row as BkRow, Select, Slider, Tabs as BkTabs,
TextInput, TextInput as BkTextInput, Toggle,
RangeSlider as BkRangeSlider, Row as BkRow, Select, Slider, Spinner,
Tabs as BkTabs, TextInput, TextInput as BkTextInput, Toggle,
)
from packaging.version import Version

Expand Down Expand Up @@ -201,6 +201,16 @@ class Test(param.Parameterized):
assert slider.end == 5.5
assert slider.disabled == True

def test_number_param_with_none(document, comm):
class Test(param.Parameterized):
a = param.Number(default=None, bounds=(0, 5))

test = Test()
test_pane = Param(test)
model = test_pane.get_root(document, comm=comm)

slider = model.children[1]
assert isinstance(slider, Spinner)

def test_boolean_param(document, comm):
class Test(param.Parameterized):
Expand Down
Loading