def METHOD_NAME():
    """Test that cancellation runs the callback function"""
    total = 10
    last_loop = -1
    expected_last_loop = -2
    def cancel_callback():
        nonlocal last_loop
        last_loop = expected_last_loop
    pbr = cancelable_progress(range(total), cancel_callback=cancel_callback)
    for i in pbr:
        last_loop = i
        # Let's cancel at i=total/2
        if i == total / 2:
            pbr.cancel()
    assert pbr.is_canceled
    assert last_loop == expected_last_loop