def testAdvanceCancel(self):
"""
Test attemping to cancel the call in a callback.
AlreadyCalled should be raised, not for example a ValueError from
removing the call from Clock.calls. This requires call.called to be
set before the callback is called.
"""
c = task.Clock()
def cb():
self.assertRaises(error.AlreadyCalled, call.cancel)
call = c.callLater(1, cb)
c.advance(1)
评论列表
文章目录