code: def test_progressbar_cancel(client):
      import time
  
      L = [client.submit(lambda: time.sleep(0.3), i) for i in range(5)]
      p = ProgressWidget(L)
      client.sync(p.listen)
      L[-1].cancel()
      wait(L[:-1])
      assert p.status == "error"
      assert p.bar.value == 0
  
file_path: distributed/distributed/diagnostics/tests/test_progress_widgets.py
imports: from __future__ import annotations
  import re
  from operator import add
  import pytest
  from dask.utils import key_split
  from distributed.client import wait
  from distributed.spans import span
  from distributed.utils_test import dec, gen_cluster, gen_tls_cluster, inc, throws
  from distributed.diagnostics.progressbar import MultiProgressWidget, ProgressWidget, progress
label_desc: Use image node_id 3 for calling a global function with example usage: test_progressbar_cancel(client) without return types