Show More
@@ -220,6 +220,84 b' def test_list_tuple_3_float():' | |||||
220 | ) |
|
220 | ) | |
221 | check_widgets(c, tup=d, lis=d) |
|
221 | check_widgets(c, tup=d, lis=d) | |
222 |
|
222 | |||
|
223 | def test_list_tuple_4_int(): | |||
|
224 | with nt.assert_raises(ValueError): | |||
|
225 | c = interactive(f, tup=(4, 3, 2, 1)) | |||
|
226 | with nt.assert_raises(ValueError): | |||
|
227 | c = interactive(f, tup=(1, 2, 3, 2)) | |||
|
228 | with nt.assert_raises(ValueError): | |||
|
229 | c = interactive(f, tup=(2, 1, 3, 4)) | |||
|
230 | for min, low, high, max in [(0, 1, 2, 3), (0, 0, 0, 0), (1, 2, 2, 3), (-2, -1, 1, 2)]: | |||
|
231 | c = interactive(f, tup=(min, low, high, max), lis=[min, low, high, max]) | |||
|
232 | nt.assert_equal(len(c.children), 2) | |||
|
233 | d = dict( | |||
|
234 | cls=widgets.IntRangeSliderWidget, | |||
|
235 | min=min, | |||
|
236 | max=max, | |||
|
237 | value=(low, high), | |||
|
238 | range=True, | |||
|
239 | readout=True | |||
|
240 | ) | |||
|
241 | check_widgets(c, tup=d, lis=d) | |||
|
242 | ||||
|
243 | def test_list_tuple_5_int(): | |||
|
244 | with nt.assert_raises(ValueError): | |||
|
245 | c = interactive(f, tup=(1, 2, 3, 4, 0)) | |||
|
246 | with nt.assert_raises(ValueError): | |||
|
247 | c = interactive(f, tup=(1, 2, 3, 4, -1)) | |||
|
248 | for min, low, high, max, step in [(0, 1, 2, 3, 1), (0, 0, 0, 0, 1), (1, 2, 2, 3, 2), (-2, -1, 1, 2, 3)]: | |||
|
249 | c = interactive(f, tup=(min, low, high, max, step), lis=[min, low, high, max, step]) | |||
|
250 | nt.assert_equal(len(c.children), 2) | |||
|
251 | d = dict( | |||
|
252 | cls=widgets.IntRangeSliderWidget, | |||
|
253 | min=min, | |||
|
254 | max=max, | |||
|
255 | value=(low, high), | |||
|
256 | step=step, | |||
|
257 | range=True, | |||
|
258 | readout=True | |||
|
259 | ) | |||
|
260 | check_widgets(c, tup=d, lis=d) | |||
|
261 | ||||
|
262 | def test_list_tuple_4_float(): | |||
|
263 | with nt.assert_raises(ValueError): | |||
|
264 | c = interactive(f, tup=(4, 3., 2, 1)) | |||
|
265 | with nt.assert_raises(ValueError): | |||
|
266 | c = interactive(f, tup=(1, 2, 3, 2.)) | |||
|
267 | with nt.assert_raises(ValueError): | |||
|
268 | c = interactive(f, tup=(2, 1., 3, 4)) | |||
|
269 | for min, low, high, max in [(0, 1., 2, 3), (0, 0, 0., 0), (1., 2., 2., 3.1415), (-2.5, -1, 1, 2.5)]: | |||
|
270 | c = interactive(f, tup=(min, low, high, max), lis=[min, low, high, max]) | |||
|
271 | nt.assert_equal(len(c.children), 2) | |||
|
272 | d = dict( | |||
|
273 | cls=widgets.FloatRangeSliderWidget, | |||
|
274 | min=min, | |||
|
275 | max=max, | |||
|
276 | value=(low, high), | |||
|
277 | range=True, | |||
|
278 | readout=True | |||
|
279 | ) | |||
|
280 | check_widgets(c, tup=d, lis=d) | |||
|
281 | ||||
|
282 | def test_list_tuple_5_float(): | |||
|
283 | with nt.assert_raises(ValueError): | |||
|
284 | c = interactive(f, tup=(1, 2., 3., 4, 0)) | |||
|
285 | with nt.assert_raises(ValueError): | |||
|
286 | c = interactive(f, tup=(1, 2, 3., 4., -0.5)) | |||
|
287 | for min, low, high, max, step in [(0, 1, 2, 3, 0.01), (0, 0, 0, 0, 0.1), (1, 2, 2, 3, 2.718), (-2, -1.5, 1.5, 2, 2)]: | |||
|
288 | c = interactive(f, tup=(min, low, high, max, step), lis=[min, low, high, max, step]) | |||
|
289 | nt.assert_equal(len(c.children), 2) | |||
|
290 | d = dict( | |||
|
291 | cls=widgets.FloatRangeSliderWidget, | |||
|
292 | min=min, | |||
|
293 | max=max, | |||
|
294 | value=(low, high), | |||
|
295 | step=step, | |||
|
296 | range=True, | |||
|
297 | readout=True | |||
|
298 | ) | |||
|
299 | check_widgets(c, tup=d, lis=d) | |||
|
300 | ||||
223 | def test_list_tuple_str(): |
|
301 | def test_list_tuple_str(): | |
224 | values = ['hello', 'there', 'guy'] |
|
302 | values = ['hello', 'there', 'guy'] | |
225 | first = values[0] |
|
303 | first = values[0] |
General Comments 0
You need to be logged in to leave comments.
Login now