コード例 #1
0
def test_mark_token_as_completed():
    ct = CancellationToken()

    ct.complete()

    assert not ct.cancelled
    assert ct.completed
コード例 #2
0
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