code: def test_PlotWidget():
      def mkobjs(*args, **kwds):
          with warnings.catch_warnings():
              warnings.simplefilter("ignore")
              w = pg.PlotWidget(*args, **kwds)
          data = np.array([1, 5, 2, 4, 3])
          c = w.plot(data, name="stuff")
          w.addLegend()
  
          # test that connections do not keep objects alive
          w.plotItem.vb.sigRangeChanged.connect(mkrefs)
          app.focusChanged.connect(w.plotItem.vb.invertY)
  
          # return weakrefs to a bunch of objects that should die when the scope exits.
          return mkrefs(
              w,
              c,
              data,
              w.plotItem,
              w.plotItem.vb,
              w.plotItem.getAxis("left"),
          )
  
      for _ in range(5):
          assert_alldead(mkobjs())
  
file_path: pyqtgraph/tests/test_ref_cycles.py
imports: import warnings
  import weakref
  import numpy
  import pyqtgraph
label_desc: Use image node_id 4 for calling a global function with example usage: test_PlotWidget() and returns: mkrefs