code: def test_interval():
      i = Interval(1, 2, axis="y", canvas_height=30, canvas_width=400)
      i.to_rectangle()
      i.to_quadrilateral()
      assert i.shift(1) == Interval(
          2, 3, axis="y", canvas_height=30, canvas_width=400
      )
      assert i.area == 1 * 400
  
      i = Interval(1, 2, axis="x")
      assert i.shift([1, 2]) == Interval(2, 3, axis="x")
      assert i.scale([2, 1]) == Interval(2, 4, axis="x")
      assert i.pad(left=10, right=20) == Interval(
          0, 22, axis="x"
      )  # Test the safe_mode
      assert i.pad(left=10, right=20, safe_mode=False) == Interval(
          -9, 22, axis="x"
      )
      assert i.area == 0
  
      img = np.random.randint(12, 24, (40, 40))
      img[:, 10:20] = 0
      i = Interval(5, 11, axis="x")
      assert np.unique(i.crop_image(img)[:, -1]) == np.array([0])
  
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 1 for calling a global function with example usage: test_interval() without return types