code: def test_rectangle():
      r = Rectangle(1, 2, 3, 4)
      r.to_interval(axis="x")
      r.to_quadrilateral()
      assert r.pad(left=1, right=5, top=2, bottom=4) == Rectangle(
          0, 0, 8, 8
      )
      assert r.shift([1, 2]) == Rectangle(2, 4, 4, 6)
      assert r.shift(1) == Rectangle(2, 3, 4, 5)
      assert r.scale([3, 2]) == Rectangle(3, 4, 9, 8)
      assert r.scale(2) == Rectangle(2, 4, 6, 8)
      assert r.area == 4
  
      img = np.random.randint(12, 24, (40, 40))
      r.crop_image(img).shape == (2, 2)
  
file_path: layout-parser/tests/test_elements.py
imports: import pytest
  import numpy
  import pandas
  from layoutparser.elements import Interval, Rectangle, Quadrilateral, TextBlock, Layout
  from layoutparser.elements.errors import InvalidShapeError, NotSupportedShapeError
label_desc: Use image node_id 2 for calling a global function with example usage: test_rectangle() without return types