MCPcopy Index your code
hub / github.com/python/cpython / test_after_info

Method test_after_info

Lib/test/test_tkinter/test_misc.py:260–298  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

258 root.tk.call('after', 'info', idle1)
259
260 def test_after_info(self):
261 root = self.root
262
263 # No events.
264 self.assertEqual(root.after_info(), ())
265
266 # Add timer.
267 timer = root.after(1, lambda: 'break')
268
269 # With no parameter, it returns a tuple of the event handler ids.
270 self.assertEqual(root.after_info(), (timer, ))
271 root.after_cancel(timer)
272
273 timer1 = root.after(5000, lambda: 'break')
274 timer2 = root.after(5000, lambda: 'break')
275 idle1 = root.after_idle(lambda: 'break')
276 # Only contains new events and not 'timer'.
277 self.assertEqual(root.after_info(), (idle1, timer2, timer1))
278
279 # With a parameter returns a tuple of (script, type).
280 timer1_info = root.after_info(timer1)
281 self.assertEqual(len(timer1_info), 2)
282 self.assertEqual(timer1_info[1], 'timer')
283 idle1_info = root.after_info(idle1)
284 self.assertEqual(len(idle1_info), 2)
285 self.assertEqual(idle1_info[1], 'idle')
286
287 root.after_cancel(timer1)
288 with self.assertRaises(tkinter.TclError):
289 root.after_info(timer1)
290 root.after_cancel(timer2)
291 with self.assertRaises(tkinter.TclError):
292 root.after_info(timer2)
293 root.after_cancel(idle1)
294 with self.assertRaises(tkinter.TclError):
295 root.after_info(idle1)
296
297 # No events.
298 self.assertEqual(root.after_info(), ())
299
300 def test_clipboard(self):
301 root = self.root

Callers

nothing calls this directly

Calls 6

after_infoMethod · 0.80
afterMethod · 0.80
after_cancelMethod · 0.80
after_idleMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected