code: def test_zoom_ratio():
      """Test zooming with a fixed aspect ratio set"""
      vb = pg.ViewBox(lockAspect=1)
  
      # Give the viewbox a size of the proper aspect ratio to keep things easy
      vb.setFixedHeight(10)
      vb.setFixedWidth(10)
  
      # request a range with a good ratio
      testRange = pg.QtCore.QRect(0, 0, 10, 10)
      vb.setRange(testRange, padding=0)
      expected = [
          [testRange.left(), testRange.right()],
          [testRange.top(), testRange.bottom()],
      ]
  
      viewRange = vb.getState()["viewRange"]
      viewWidth = viewRange[0][1] - viewRange[0][0]
      viewHeight = viewRange[1][1] - viewRange[1][0]
  
      # Assert that the width and height are equal, since we locked the aspect ratio at 1
      assert viewWidth == viewHeight
  
      # and for good measure, that it is the same as the test range
      assert viewRange == expected
  
      # Now try to set to something with a different aspect ratio
      testRange = pg.QtCore.QRect(0, 0, 10, 20)
      vb.setRange(testRange, padding=0)
  
      viewRange = vb.getState()["viewRange"]
      viewWidth = viewRange[0][1] - viewRange[0][0]
      viewHeight = viewRange[1][1] - viewRange[1][0]
  
      # Don't really care what we got here, as long as the width and height are the same
      assert viewWidth == viewHeight
  
file_path: pyqtgraph/tests/graphicsItems/ViewBox/test_ViewBoxZoom.py
imports: import pyqtgraph
label_desc: Use image node_id 4 for calling a global function with example usage: test_zoom_ratio() without return types