|
14 | 14 | from traitlets import TraitError
|
15 | 15 | from ipywidgets import (interact, interact_manual, interactive,
|
16 | 16 | interaction, Output)
|
17 |
| -from ipython_genutils.py3compat import annotate |
18 | 17 |
|
19 | 18 | #-----------------------------------------------------------------------------
|
20 | 19 | # Utility stuff
|
@@ -277,115 +276,6 @@ def items(self):
|
277 | 276 | )
|
278 | 277 | check_widgets(c, lis=d)
|
279 | 278 |
|
280 |
| - |
281 |
| -def test_defaults(): |
282 |
| - @annotate(n=10) |
283 |
| - def f(n, f=4.5, g=1): |
284 |
| - pass |
285 |
| - |
286 |
| - c = interactive(f) |
287 |
| - check_widgets(c, |
288 |
| - n=dict( |
289 |
| - cls=widgets.IntSlider, |
290 |
| - value=10, |
291 |
| - ), |
292 |
| - f=dict( |
293 |
| - cls=widgets.FloatSlider, |
294 |
| - value=4.5, |
295 |
| - ), |
296 |
| - g=dict( |
297 |
| - cls=widgets.IntSlider, |
298 |
| - value=1, |
299 |
| - ), |
300 |
| - ) |
301 |
| - |
302 |
| -def test_default_values(): |
303 |
| - @annotate(n=10, f=(0, 10.), g=5, h=OrderedDict([('a',1), ('b',2)]), j=['hi', 'there']) |
304 |
| - def f(n, f=4.5, g=1, h=2, j='there'): |
305 |
| - pass |
306 |
| - |
307 |
| - c = interactive(f) |
308 |
| - check_widgets(c, |
309 |
| - n=dict( |
310 |
| - cls=widgets.IntSlider, |
311 |
| - value=10, |
312 |
| - ), |
313 |
| - f=dict( |
314 |
| - cls=widgets.FloatSlider, |
315 |
| - value=4.5, |
316 |
| - ), |
317 |
| - g=dict( |
318 |
| - cls=widgets.IntSlider, |
319 |
| - value=5, |
320 |
| - ), |
321 |
| - h=dict( |
322 |
| - cls=widgets.Dropdown, |
323 |
| - options=OrderedDict([('a',1), ('b',2)]), |
324 |
| - value=2 |
325 |
| - ), |
326 |
| - j=dict( |
327 |
| - cls=widgets.Dropdown, |
328 |
| - options=('hi', 'there'), |
329 |
| - value='there' |
330 |
| - ), |
331 |
| - ) |
332 |
| - |
333 |
| -def test_default_out_of_bounds(): |
334 |
| - @annotate(f=(0, 10.), h={'a': 1}, j=['hi', 'there']) |
335 |
| - def f(f='hi', h=5, j='other'): |
336 |
| - pass |
337 |
| - |
338 |
| - c = interactive(f) |
339 |
| - check_widgets(c, |
340 |
| - f=dict( |
341 |
| - cls=widgets.FloatSlider, |
342 |
| - value=5., |
343 |
| - ), |
344 |
| - h=dict( |
345 |
| - cls=widgets.Dropdown, |
346 |
| - options={'a': 1}, |
347 |
| - value=1, |
348 |
| - ), |
349 |
| - j=dict( |
350 |
| - cls=widgets.Dropdown, |
351 |
| - options=('hi', 'there'), |
352 |
| - value='hi', |
353 |
| - ), |
354 |
| - ) |
355 |
| - |
356 |
| -def test_annotations(): |
357 |
| - @annotate(n=10, f=widgets.FloatText()) |
358 |
| - def f(n, f): |
359 |
| - pass |
360 |
| - |
361 |
| - c = interactive(f) |
362 |
| - check_widgets(c, |
363 |
| - n=dict( |
364 |
| - cls=widgets.IntSlider, |
365 |
| - value=10, |
366 |
| - ), |
367 |
| - f=dict( |
368 |
| - cls=widgets.FloatText, |
369 |
| - ), |
370 |
| - ) |
371 |
| - |
372 |
| -def test_priority(): |
373 |
| - @annotate(annotate='annotate', kwarg='annotate') |
374 |
| - def f(kwarg='default', annotate='default', default='default'): |
375 |
| - pass |
376 |
| - |
377 |
| - c = interactive(f, kwarg='kwarg') |
378 |
| - check_widgets(c, |
379 |
| - kwarg=dict( |
380 |
| - cls=widgets.Text, |
381 |
| - value='kwarg', |
382 |
| - ), |
383 |
| - annotate=dict( |
384 |
| - cls=widgets.Text, |
385 |
| - value='annotate', |
386 |
| - ), |
387 |
| - ) |
388 |
| - |
389 | 279 | def test_decorator_kwarg(clear_display):
|
390 | 280 | with patch.object(interaction, 'display', record_display):
|
391 | 281 | @interact(a=5)
|
|
0 commit comments