(self)
| 217 | self.assertEqual(count, 54) |
| 218 | |
| 219 | def test_after_cancel(self): |
| 220 | root = self.root |
| 221 | |
| 222 | def callback(): |
| 223 | nonlocal count |
| 224 | count += 1 |
| 225 | |
| 226 | timer1 = root.after(5000, callback) |
| 227 | idle1 = root.after_idle(callback) |
| 228 | |
| 229 | # No value for id raises a ValueError. |
| 230 | with self.assertRaises(ValueError): |
| 231 | root.after_cancel(None) |
| 232 | |
| 233 | # Cancel timer event. |
| 234 | count = 0 |
| 235 | (script, _) = root.tk.splitlist(root.tk.call('after', 'info', timer1)) |
| 236 | root.tk.call(script) |
| 237 | self.assertEqual(count, 1) |
| 238 | root.after_cancel(timer1) |
| 239 | with self.assertRaises(tkinter.TclError): |
| 240 | root.tk.call(script) |
| 241 | self.assertEqual(count, 1) |
| 242 | with self.assertRaises(tkinter.TclError): |
| 243 | root.tk.call('after', 'info', timer1) |
| 244 | |
| 245 | # Cancel same event - nothing happens. |
| 246 | root.after_cancel(timer1) |
| 247 | |
| 248 | # Cancel idle event. |
| 249 | count = 0 |
| 250 | (script, _) = root.tk.splitlist(root.tk.call('after', 'info', idle1)) |
| 251 | root.tk.call(script) |
| 252 | self.assertEqual(count, 1) |
| 253 | root.after_cancel(idle1) |
| 254 | with self.assertRaises(tkinter.TclError): |
| 255 | root.tk.call(script) |
| 256 | self.assertEqual(count, 1) |
| 257 | with self.assertRaises(tkinter.TclError): |
| 258 | root.tk.call('after', 'info', idle1) |
| 259 | |
| 260 | def test_after_info(self): |
| 261 | root = self.root |
nothing calls this directly
no test coverage detected