##// END OF EJS Templates
Fix interact tests for rename
Jonathan Frederic -
Show More
@@ -92,7 +92,7 b' def test_single_value_string():'
92 92 c = interactive(f, a=a)
93 93 w = c.children[0]
94 94 check_widget(w,
95 cls=widgets.TextWidget,
95 cls=widgets.Text,
96 96 description='a',
97 97 value=a,
98 98 )
@@ -102,7 +102,7 b' def test_single_value_bool():'
102 102 c = interactive(f, a=a)
103 103 w = c.children[0]
104 104 check_widget(w,
105 cls=widgets.CheckboxWidget,
105 cls=widgets.Checkbox,
106 106 description='a',
107 107 value=a,
108 108 )
@@ -115,7 +115,7 b' def test_single_value_dict():'
115 115 c = interactive(f, d=d)
116 116 w = c.children[0]
117 117 check_widget(w,
118 cls=widgets.DropdownWidget,
118 cls=widgets.Dropdown,
119 119 description='d',
120 120 values=d,
121 121 value=next(iter(d.values())),
@@ -126,7 +126,7 b' def test_single_value_float():'
126 126 c = interactive(f, a=a)
127 127 w = c.children[0]
128 128 check_widget(w,
129 cls=widgets.FloatSliderWidget,
129 cls=widgets.FloatSlider,
130 130 description='a',
131 131 value=a,
132 132 min= -a if a > 0 else 3*a,
@@ -141,7 +141,7 b' def test_single_value_int():'
141 141 nt.assert_equal(len(c.children), 1)
142 142 w = c.children[0]
143 143 check_widget(w,
144 cls=widgets.IntSliderWidget,
144 cls=widgets.IntSlider,
145 145 description='a',
146 146 value=a,
147 147 min= -a if a > 0 else 3*a,
@@ -159,7 +159,7 b' def test_list_tuple_2_int():'
159 159 c = interactive(f, tup=(min, max), lis=[min, max])
160 160 nt.assert_equal(len(c.children), 2)
161 161 d = dict(
162 cls=widgets.IntSliderWidget,
162 cls=widgets.IntSlider,
163 163 min=min,
164 164 max=max,
165 165 step=1,
@@ -176,7 +176,7 b' def test_list_tuple_3_int():'
176 176 c = interactive(f, tup=(min, max, step), lis=[min, max, step])
177 177 nt.assert_equal(len(c.children), 2)
178 178 d = dict(
179 cls=widgets.IntSliderWidget,
179 cls=widgets.IntSlider,
180 180 min=min,
181 181 max=max,
182 182 step=step,
@@ -193,7 +193,7 b' def test_list_tuple_2_float():'
193 193 c = interactive(f, tup=(min, max), lis=[min, max])
194 194 nt.assert_equal(len(c.children), 2)
195 195 d = dict(
196 cls=widgets.FloatSliderWidget,
196 cls=widgets.FloatSlider,
197 197 min=min,
198 198 max=max,
199 199 step=.1,
@@ -212,7 +212,7 b' def test_list_tuple_3_float():'
212 212 c = interactive(f, tup=(min, max, step), lis=[min, max, step])
213 213 nt.assert_equal(len(c.children), 2)
214 214 d = dict(
215 cls=widgets.FloatSliderWidget,
215 cls=widgets.FloatSlider,
216 216 min=min,
217 217 max=max,
218 218 step=step,
@@ -227,7 +227,7 b' def test_list_tuple_str():'
227 227 c = interactive(f, tup=tuple(values), lis=list(values))
228 228 nt.assert_equal(len(c.children), 2)
229 229 d = dict(
230 cls=widgets.DropdownWidget,
230 cls=widgets.Dropdown,
231 231 value=first,
232 232 values=dvalues
233 233 )
@@ -253,15 +253,15 b' def test_defaults():'
253 253 c = interactive(f)
254 254 check_widgets(c,
255 255 n=dict(
256 cls=widgets.IntSliderWidget,
256 cls=widgets.IntSlider,
257 257 value=10,
258 258 ),
259 259 f=dict(
260 cls=widgets.FloatSliderWidget,
260 cls=widgets.FloatSlider,
261 261 value=4.5,
262 262 ),
263 263 g=dict(
264 cls=widgets.IntSliderWidget,
264 cls=widgets.IntSlider,
265 265 value=1,
266 266 ),
267 267 )
@@ -274,24 +274,24 b' def test_default_values():'
274 274 c = interactive(f)
275 275 check_widgets(c,
276 276 n=dict(
277 cls=widgets.IntSliderWidget,
277 cls=widgets.IntSlider,
278 278 value=10,
279 279 ),
280 280 f=dict(
281 cls=widgets.FloatSliderWidget,
281 cls=widgets.FloatSlider,
282 282 value=4.5,
283 283 ),
284 284 g=dict(
285 cls=widgets.IntSliderWidget,
285 cls=widgets.IntSlider,
286 286 value=5,
287 287 ),
288 288 h=dict(
289 cls=widgets.DropdownWidget,
289 cls=widgets.Dropdown,
290 290 values={'a': 1, 'b': 2},
291 291 value=2
292 292 ),
293 293 j=dict(
294 cls=widgets.DropdownWidget,
294 cls=widgets.Dropdown,
295 295 values={'hi':'hi', 'there':'there'},
296 296 value='there'
297 297 ),
@@ -305,34 +305,34 b' def test_default_out_of_bounds():'
305 305 c = interactive(f)
306 306 check_widgets(c,
307 307 f=dict(
308 cls=widgets.FloatSliderWidget,
308 cls=widgets.FloatSlider,
309 309 value=5.,
310 310 ),
311 311 h=dict(
312 cls=widgets.DropdownWidget,
312 cls=widgets.Dropdown,
313 313 values={'a': 1},
314 314 value=1,
315 315 ),
316 316 j=dict(
317 cls=widgets.DropdownWidget,
317 cls=widgets.Dropdown,
318 318 values={'hi':'hi', 'there':'there'},
319 319 value='hi',
320 320 ),
321 321 )
322 322
323 323 def test_annotations():
324 @annotate(n=10, f=widgets.FloatTextWidget())
324 @annotate(n=10, f=widgets.FloatText())
325 325 def f(n, f):
326 326 pass
327 327
328 328 c = interactive(f)
329 329 check_widgets(c,
330 330 n=dict(
331 cls=widgets.IntSliderWidget,
331 cls=widgets.IntSlider,
332 332 value=10,
333 333 ),
334 334 f=dict(
335 cls=widgets.FloatTextWidget,
335 cls=widgets.FloatText,
336 336 ),
337 337 )
338 338
@@ -344,11 +344,11 b' def test_priority():'
344 344 c = interactive(f, kwarg='kwarg')
345 345 check_widgets(c,
346 346 kwarg=dict(
347 cls=widgets.TextWidget,
347 cls=widgets.Text,
348 348 value='kwarg',
349 349 ),
350 350 annotate=dict(
351 cls=widgets.TextWidget,
351 cls=widgets.Text,
352 352 value='annotate',
353 353 ),
354 354 )
@@ -362,7 +362,7 b' def test_decorator_kwarg():'
362 362 nt.assert_equal(len(displayed), 1)
363 363 w = displayed[0].children[0]
364 364 check_widget(w,
365 cls=widgets.IntSliderWidget,
365 cls=widgets.IntSlider,
366 366 value=5,
367 367 )
368 368
@@ -375,7 +375,7 b' def test_decorator_no_call():'
375 375 nt.assert_equal(len(displayed), 1)
376 376 w = displayed[0].children[0]
377 377 check_widget(w,
378 cls=widgets.TextWidget,
378 cls=widgets.Text,
379 379 value='default',
380 380 )
381 381
@@ -388,7 +388,7 b' def test_call_interact():'
388 388 nt.assert_equal(len(displayed), 1)
389 389 w = displayed[0].children[0]
390 390 check_widget(w,
391 cls=widgets.TextWidget,
391 cls=widgets.Text,
392 392 value='default',
393 393 )
394 394
@@ -401,7 +401,7 b' def test_call_interact_kwargs():'
401 401 nt.assert_equal(len(displayed), 1)
402 402 w = displayed[0].children[0]
403 403 check_widget(w,
404 cls=widgets.IntSliderWidget,
404 cls=widgets.IntSlider,
405 405 value=10,
406 406 )
407 407
@@ -417,7 +417,7 b' def test_call_decorated_on_trait_change():'
417 417 nt.assert_equal(len(displayed), 1)
418 418 w = displayed[0].children[0]
419 419 check_widget(w,
420 cls=widgets.TextWidget,
420 cls=widgets.Text,
421 421 value='default',
422 422 )
423 423 # test calling the function directly
@@ -441,7 +441,7 b' def test_call_decorated_kwargs_on_trait_change():'
441 441 nt.assert_equal(len(displayed), 1)
442 442 w = displayed[0].children[0]
443 443 check_widget(w,
444 cls=widgets.TextWidget,
444 cls=widgets.Text,
445 445 value='kwarg',
446 446 )
447 447 # test calling the function directly
@@ -458,7 +458,7 b' def test_fixed():'
458 458 nt.assert_equal(len(c.children), 1)
459 459 w = c.children[0]
460 460 check_widget(w,
461 cls=widgets.TextWidget,
461 cls=widgets.Text,
462 462 value='text',
463 463 description='b',
464 464 )
@@ -467,16 +467,16 b' def test_default_description():'
467 467 c = interactive(f, b='text')
468 468 w = c.children[0]
469 469 check_widget(w,
470 cls=widgets.TextWidget,
470 cls=widgets.Text,
471 471 value='text',
472 472 description='b',
473 473 )
474 474
475 475 def test_custom_description():
476 c = interactive(f, b=widgets.TextWidget(value='text', description='foo'))
476 c = interactive(f, b=widgets.Text(value='text', description='foo'))
477 477 w = c.children[0]
478 478 check_widget(w,
479 cls=widgets.TextWidget,
479 cls=widgets.Text,
480 480 value='text',
481 481 description='foo',
482 482 )
General Comments 0
You need to be logged in to leave comments. Login now