def test_mark_token_as_completed(): ct = CancellationToken() ct.complete() assert not ct.cancelled assert ct.completed
def test_dont_call_callback_being_added_to_completed_token(): ct = CancellationToken() flag = Counter() ct.complete() ct.on_cancel(flag.inc) assert flag.count == 0