Show More
@@ -166,7 +166,8 b' def _widgets_from_abbreviations(seq):' | |||||
166 | result = [] |
|
166 | result = [] | |
167 | for name, abbrev, default in seq: |
|
167 | for name, abbrev, default in seq: | |
168 | widget = _widget_from_abbrev(abbrev, default) |
|
168 | widget = _widget_from_abbrev(abbrev, default) | |
169 |
widget.description |
|
169 | if not widget.description: | |
|
170 | widget.description = name | |||
170 | result.append(widget) |
|
171 | result.append(widget) | |
171 | return result |
|
172 | return result | |
172 |
|
173 |
@@ -463,3 +463,20 b' def test_fixed():' | |||||
463 | description='b', |
|
463 | description='b', | |
464 | ) |
|
464 | ) | |
465 |
|
465 | |||
|
466 | def test_default_description(): | |||
|
467 | c = interactive(f, b='text') | |||
|
468 | w = c.children[0] | |||
|
469 | check_widget(w, | |||
|
470 | cls=widgets.TextWidget, | |||
|
471 | value='text', | |||
|
472 | description='b', | |||
|
473 | ) | |||
|
474 | ||||
|
475 | def test_custom_description(): | |||
|
476 | c = interactive(f, b=widgets.TextWidget(value='text', description='foo')) | |||
|
477 | w = c.children[0] | |||
|
478 | check_widget(w, | |||
|
479 | cls=widgets.TextWidget, | |||
|
480 | value='text', | |||
|
481 | description='foo', | |||
|
482 | ) |
@@ -1,7 +1,7 b'' | |||||
1 | { |
|
1 | { | |
2 | "metadata": { |
|
2 | "metadata": { | |
3 | "name": "", |
|
3 | "name": "", | |
4 | "signature": "sha256:d75ab1c53fa3389eeac78ecf8e89beb52871950f296aad25776699b6d6125037" |
|
4 | "signature": "sha256:3f30c6e839ac39f890da34a2af6bf50bf0d99ea32f7aadc043f3e31f619e4bc9" | |
5 | }, |
|
5 | }, | |
6 | "nbformat": 3, |
|
6 | "nbformat": 3, | |
7 | "nbformat_minor": 0, |
|
7 | "nbformat_minor": 0, | |
@@ -87,7 +87,7 b'' | |||||
87 | "metadata": {}, |
|
87 | "metadata": {}, | |
88 | "output_type": "display_data", |
|
88 | "output_type": "display_data", | |
89 | "text": [ |
|
89 | "text": [ | |
90 |
"<IPython.core.display.HTML |
|
90 | "<IPython.core.display.HTML object>" | |
91 | ] |
|
91 | ] | |
92 | } |
|
92 | } | |
93 | ], |
|
93 | ], | |
@@ -110,7 +110,7 b'' | |||||
110 | " z=True,\n", |
|
110 | " z=True,\n", | |
111 | " Text=u'Type here!',\n", |
|
111 | " Text=u'Type here!',\n", | |
112 | " #Algorithm=['This','That','Other'],\n", |
|
112 | " #Algorithm=['This','That','Other'],\n", | |
113 | " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0)\n", |
|
113 | " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0, description=\"Float (a)\")\n", | |
114 | " )" |
|
114 | " )" | |
115 | ], |
|
115 | ], | |
116 | "language": "python", |
|
116 | "language": "python", | |
@@ -122,14 +122,14 b'' | |||||
122 | "<tr><td>Current</td><td>4.99</td></tr>\n", |
|
122 | "<tr><td>Current</td><td>4.99</td></tr>\n", | |
123 | "<tr><td>Text</td><td>Type here!</td></tr>\n", |
|
123 | "<tr><td>Text</td><td>Type here!</td></tr>\n", | |
124 | "<tr><td>z</td><td>True</td></tr>\n", |
|
124 | "<tr><td>z</td><td>True</td></tr>\n", | |
125 | "<tr><td>a</td><td>5.0</td></tr>\n", |
|
|||
126 | "<tr><td>Temp</td><td>5</td></tr>\n", |
|
125 | "<tr><td>Temp</td><td>5</td></tr>\n", | |
|
126 | "<tr><td>Float (a)</td><td>5.0</td></tr>\n", | |||
127 | "</table>" |
|
127 | "</table>" | |
128 | ], |
|
128 | ], | |
129 | "metadata": {}, |
|
129 | "metadata": {}, | |
130 | "output_type": "display_data", |
|
130 | "output_type": "display_data", | |
131 | "text": [ |
|
131 | "text": [ | |
132 |
"<IPython.core.display.HTML |
|
132 | "<IPython.core.display.HTML object>" | |
133 | ] |
|
133 | ] | |
134 | } |
|
134 | } | |
135 | ], |
|
135 | ], | |
@@ -150,14 +150,14 b'' | |||||
150 | "<tr><td>Current</td><td>4.99</td></tr>\n", |
|
150 | "<tr><td>Current</td><td>4.99</td></tr>\n", | |
151 | "<tr><td>Text</td><td>Type here!</td></tr>\n", |
|
151 | "<tr><td>Text</td><td>Type here!</td></tr>\n", | |
152 | "<tr><td>z</td><td>True</td></tr>\n", |
|
152 | "<tr><td>z</td><td>True</td></tr>\n", | |
153 | "<tr><td>a</td><td>5.0</td></tr>\n", |
|
|||
154 | "<tr><td>Temp</td><td>5</td></tr>\n", |
|
153 | "<tr><td>Temp</td><td>5</td></tr>\n", | |
|
154 | "<tr><td>Float (a)</td><td>5.0</td></tr>\n", | |||
155 | "</table>" |
|
155 | "</table>" | |
156 | ], |
|
156 | ], | |
157 | "metadata": {}, |
|
157 | "metadata": {}, | |
158 | "output_type": "display_data", |
|
158 | "output_type": "display_data", | |
159 | "text": [ |
|
159 | "text": [ | |
160 |
"<IPython.core.display.HTML |
|
160 | "<IPython.core.display.HTML object>" | |
161 | ] |
|
161 | ] | |
162 | } |
|
162 | } | |
163 | ], |
|
163 | ], |
General Comments 0
You need to be logged in to leave comments.
Login now