code: def test_SystemMonitor():
      sm = SystemMonitor()
  
      # __init__ calls update()
      a = sm.recent()
      assert any(v > 0 for v in a.values())
  
      sleep(0.01)
      b = sm.update()
      assert set(a) == set(b)
  
      for name in (
          "cpu",
          "memory",
          "time",
          "host_net_io.read_bps",
          "host_net_io.write_bps",
      ):
          assert all(v >= 0 for v in sm.quantities[name])
  
      assert all(len(q) == 2 for q in sm.quantities.values())
  
      assert "cpu" in repr(sm)
  
file_path: distributed/distributed/tests/test_system_monitor.py
imports: from __future__ import annotations
  from time import sleep
  import pytest
  import dask
  from distributed.system_monitor import SystemMonitor
label_desc: Use image node_id 1 for calling a global function with example usage: test_SystemMonitor() without return types