code: def test_timeslide_snap():
      count = 31
      frames = np.ones((count, 10, 10))
      iv = pg.ImageView(discreteTimeLine=True)
      assert iv.nframes() == 0
      iv.setImage(frames, xvals=(np.linspace(0.0, 1.0, count)))
      iv.show()
      assert iv.nframes() == count
      speed = count / 2
      iv.play(speed)
      assert iv.playRate == speed
      iv.timeLine.setPos(0.51)  # side effect: also pauses playback
      assert iv.playRate == 0
      ind, val = iv.timeIndex(iv.timeLine)
      assert ind == count // 2
      assert val == 0.5
      iv.togglePause()  # restarts playback
      assert iv.playRate == speed
      iv.togglePause()  # pauses playback
      assert iv.playRate == 0
      iv.play()
      assert iv.playRate == speed
  
imports: import numpy
  import pyqtgraph
label_desc: Use image node_id 2 for calling a global function with example usage: test_timeslide_snap() without return types