code: def test_rectangle_relations():
      i = Interval(4, 5, axis="y")
      q = Quadrilateral(np.array([[2, 2], [6, 2], [6, 7], [2, 5]]))
      r = Rectangle(3, 3, 5, 6)
  
      assert not r.is_in(q)
      assert r.is_in(q, soft_margin={"bottom": 1})
      assert r.is_in(q.to_rectangle())
      assert r.is_in(q.to_interval(axis="x"))
  
      # convert to absolute then convert back to relative
      assert r.condition_on(i).relative_to(i) == r
      assert r.condition_on(r).relative_to(r) == r
      assert r.condition_on(q).relative_to(q) == r.to_quadrilateral()
  
      # convert to relative then convert back to absolute
      assert r.relative_to(i).condition_on(i) == r
      assert r.relative_to(r).condition_on(r) == r
      assert r.relative_to(q).condition_on(q) == r.to_quadrilateral()
  
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 5 for calling a global function with example usage: test_rectangle_relations() without return types