mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #7508 from minrk/widget-description-kwarg
Don't use widget.description as kwarg key
This commit is contained in:
commit
7b8a64241f
@ -155,6 +155,7 @@ def _widgets_from_abbreviations(seq):
|
||||
widget = _widget_from_abbrev(abbrev, default)
|
||||
if not widget.description:
|
||||
widget.description = name
|
||||
widget._kwarg = name
|
||||
result.append(widget)
|
||||
return result
|
||||
|
||||
@ -194,7 +195,7 @@ def interactive(__interact_f, **kwargs):
|
||||
container.kwargs = {}
|
||||
for widget in kwargs_widgets:
|
||||
value = widget.value
|
||||
container.kwargs[widget.description] = value
|
||||
container.kwargs[widget._kwarg] = value
|
||||
if co:
|
||||
clear_output(wait=True)
|
||||
if manual:
|
||||
|
@ -489,13 +489,20 @@ def test_default_description():
|
||||
)
|
||||
|
||||
def test_custom_description():
|
||||
c = interactive(f, b=widgets.Text(value='text', description='foo'))
|
||||
d = {}
|
||||
def record_kwargs(**kwargs):
|
||||
d.clear()
|
||||
d.update(kwargs)
|
||||
|
||||
c = interactive(record_kwargs, b=widgets.Text(value='text', description='foo'))
|
||||
w = c.children[0]
|
||||
check_widget(w,
|
||||
cls=widgets.Text,
|
||||
value='text',
|
||||
description='foo',
|
||||
)
|
||||
w.value = 'different text'
|
||||
nt.assert_equal(d, {'b': 'different text'})
|
||||
|
||||
def test_interact_manual_button():
|
||||
c = interactive(f, __manual=True)
|
||||
|
Loading…
Reference in New Issue
Block a user