1
1
{
2
2
"metadata" : {
3
- "name" : " " ,
4
- "signature" : " sha256:a1ac68aba163c75eab3d1fc91aa4d9a8ca66b09159619563827a19967d96814b"
3
+ "kernelspec" : {
4
+ "display_name" : " Python 2" ,
5
+ "language" : " python" ,
6
+ "name" : " python2"
7
+ },
8
+ "language_info" : {
9
+ "codemirror_mode" : {
10
+ "name" : " ipython" ,
11
+ "version" : 2
12
+ },
13
+ "file_extension" : " .py" ,
14
+ "mimetype" : " text/x-python" ,
15
+ "name" : " python" ,
16
+ "nbconvert_exporter" : " python" ,
17
+ "pygments_lexer" : " ipython2" ,
18
+ "version" : " 2.7.10"
19
+ },
20
+ "name" : " "
5
21
},
6
22
"nbformat" : 3 ,
7
23
"nbformat_minor" : 0 ,
17
33
],
18
34
"language" : " python" ,
19
35
"metadata" : {},
20
- "outputs" : []
36
+ "outputs" : [],
37
+ "prompt_number" : null
21
38
},
22
39
{
23
40
"cell_type" : " markdown" ,
42
59
],
43
60
"language" : " python" ,
44
61
"metadata" : {},
45
- "outputs" : []
62
+ "outputs" : [],
63
+ "prompt_number" : null
46
64
},
47
65
{
48
66
"cell_type" : " markdown" ,
70
88
],
71
89
"language" : " python" ,
72
90
"metadata" : {},
73
- "outputs" : []
91
+ "outputs" : [],
92
+ "prompt_number" : null
74
93
},
75
94
{
76
95
"cell_type" : " markdown" ,
90
109
],
91
110
"language" : " python" ,
92
111
"metadata" : {},
93
- "outputs" : []
112
+ "outputs" : [],
113
+ "prompt_number" : null
94
114
},
95
115
{
96
116
"cell_type" : " markdown" ,
109
129
],
110
130
"language" : " python" ,
111
131
"metadata" : {},
112
- "outputs" : []
132
+ "outputs" : [],
133
+ "prompt_number" : null
113
134
},
114
135
{
115
136
"cell_type" : " markdown" ,
128
149
],
129
150
"language" : " python" ,
130
151
"metadata" : {},
131
- "outputs" : []
152
+ "outputs" : [],
153
+ "prompt_number" : null
132
154
},
133
155
{
134
156
"cell_type" : " markdown" ,
148
170
],
149
171
"language" : " python" ,
150
172
"metadata" : {},
151
- "outputs" : []
173
+ "outputs" : [],
174
+ "prompt_number" : null
152
175
},
153
176
{
154
177
"cell_type" : " markdown" ,
167
190
],
168
191
"language" : " python" ,
169
192
"metadata" : {},
170
- "outputs" : []
193
+ "outputs" : [],
194
+ "prompt_number" : null
171
195
},
172
196
{
173
197
"cell_type" : " markdown" ,
189
213
],
190
214
"language" : " python" ,
191
215
"metadata" : {},
192
- "outputs" : []
216
+ "outputs" : [],
217
+ "prompt_number" : null
193
218
},
194
219
{
195
220
"cell_type" : " markdown" ,
210
235
],
211
236
"language" : " python" ,
212
237
"metadata" : {},
213
- "outputs" : []
238
+ "outputs" : [],
239
+ "prompt_number" : null
214
240
},
215
241
{
216
242
"cell_type" : " markdown" ,
227
253
],
228
254
"language" : " python" ,
229
255
"metadata" : {},
230
- "outputs" : []
256
+ "outputs" : [],
257
+ "prompt_number" : null
231
258
},
232
259
{
233
260
"cell_type" : " markdown" ,
244
271
],
245
272
"language" : " python" ,
246
273
"metadata" : {},
247
- "outputs" : []
274
+ "outputs" : [],
275
+ "prompt_number" : null
248
276
},
249
277
{
250
278
"cell_type" : " markdown" ,
263
291
],
264
292
"language" : " python" ,
265
293
"metadata" : {},
266
- "outputs" : []
294
+ "outputs" : [],
295
+ "prompt_number" : null
267
296
},
268
297
{
269
298
"cell_type" : " markdown" ,
298
327
],
299
328
"language" : " python" ,
300
329
"metadata" : {},
301
- "outputs" : []
330
+ "outputs" : [],
331
+ "prompt_number" : null
302
332
},
303
333
{
304
334
"cell_type" : " markdown" ,
323
353
],
324
354
"language" : " python" ,
325
355
"metadata" : {},
326
- "outputs" : []
356
+ "outputs" : [],
357
+ "prompt_number" : null
327
358
},
328
359
{
329
360
"cell_type" : " markdown" ,
361
392
],
362
393
"language" : " python" ,
363
394
"metadata" : {},
364
- "outputs" : []
395
+ "outputs" : [],
396
+ "prompt_number" : null
365
397
},
366
398
{
367
399
"cell_type" : " markdown" ,
394
426
],
395
427
"language" : " python" ,
396
428
"metadata" : {},
397
- "outputs" : []
429
+ "outputs" : [],
430
+ "prompt_number" : null
398
431
},
399
432
{
400
433
"cell_type" : " markdown" ,
438
471
],
439
472
"language" : " python" ,
440
473
"metadata" : {},
441
- "outputs" : []
474
+ "outputs" : [],
475
+ "prompt_number" : null
476
+ },
477
+ {
478
+ "cell_type" : " markdown" ,
479
+ "metadata" : {},
480
+ "source" : [
481
+ " ### UAT 17 - Timers\n " ,
482
+ " \n " ,
483
+ " Single-shot timers follow a completely different code path in the nbagg backend than regular timers (such as those used in the animation example above.) The next set of tests ensures that both \" regular\" and \" single-shot\" timers work properly.\n " ,
484
+ " \n " ,
485
+ " The following should show a simple clock that updates twice a second:"
486
+ ]
487
+ },
488
+ {
489
+ "cell_type" : " code" ,
490
+ "collapsed" : true ,
491
+ "input" : [
492
+ " import time\n " ,
493
+ " \n " ,
494
+ " fig, ax = plt.subplots()\n " ,
495
+ " text = ax.text(0.5, 0.5, '', ha='center')\n " ,
496
+ " \n " ,
497
+ " def update(text):\n " ,
498
+ " text.set(text=time.ctime())\n " ,
499
+ " text.axes.figure.canvas.draw()\n " ,
500
+ " \n " ,
501
+ " timer = fig.canvas.new_timer(500, [(update, [text], {})])\n " ,
502
+ " timer.start()\n " ,
503
+ " plt.show()"
504
+ ],
505
+ "language" : " python" ,
506
+ "metadata" : {},
507
+ "outputs" : [],
508
+ "prompt_number" : null
509
+ },
510
+ {
511
+ "cell_type" : " markdown" ,
512
+ "metadata" : {},
513
+ "source" : [
514
+ " However, the following should only update once and then stop:"
515
+ ]
516
+ },
517
+ {
518
+ "cell_type" : " code" ,
519
+ "collapsed" : true ,
520
+ "input" : [
521
+ " fig, ax = plt.subplots()\n " ,
522
+ " text = ax.text(0.5, 0.5, '', ha='center') \n " ,
523
+ " timer = fig.canvas.new_timer(500, [(update, [text], {})])\n " ,
524
+ " \n " ,
525
+ " time.single_shot = True\n " ,
526
+ " timer.start()\n " ,
527
+ " \n " ,
528
+ " plt.show()"
529
+ ],
530
+ "language" : " python" ,
531
+ "metadata" : {},
532
+ "outputs" : [],
533
+ "prompt_number" : null
534
+ },
535
+ {
536
+ "cell_type" : " markdown" ,
537
+ "metadata" : {},
538
+ "source" : [
539
+ " And the next two examples should never show any visible text at all:"
540
+ ]
541
+ },
542
+ {
543
+ "cell_type" : " code" ,
544
+ "collapsed" : true ,
545
+ "input" : [
546
+ " fig, ax = plt.subplots()\n " ,
547
+ " text = ax.text(0.5, 0.5, '', ha='center')\n " ,
548
+ " timer = fig.canvas.new_timer(500, [(update, [text], {})])\n " ,
549
+ " \n " ,
550
+ " timer.start()\n " ,
551
+ " timer.stop()\n " ,
552
+ " \n " ,
553
+ " plt.show()"
554
+ ],
555
+ "language" : " python" ,
556
+ "metadata" : {},
557
+ "outputs" : [],
558
+ "prompt_number" : null
559
+ },
560
+ {
561
+ "cell_type" : " code" ,
562
+ "collapsed" : true ,
563
+ "input" : [
564
+ " fig, ax = plt.subplots()\n " ,
565
+ " text = ax.text(0.5, 0.5, '', ha='center')\n " ,
566
+ " timer = fig.canvas.new_timer(500, [(update, [text], {})])\n " ,
567
+ " \n " ,
568
+ " timer.single_shot = True\n " ,
569
+ " timer.start()\n " ,
570
+ " timer.stop()\n " ,
571
+ " \n " ,
572
+ " plt.show()"
573
+ ],
574
+ "language" : " python" ,
575
+ "metadata" : {},
576
+ "outputs" : [],
577
+ "prompt_number" : null
442
578
}
443
579
],
444
580
"metadata" : {}
445
581
}
446
582
]
447
- }
583
+ }
0 commit comments