code: def test_format_polygon():
      # check basic cases
      poly = Point(0, 0).buffer(10, 2)
      assert f"{poly}" == poly.wkt
      assert format(poly, "") == poly.wkt
      assert format(poly, "x") == poly.wkb_hex.lower()
      assert format(poly, "X") == poly.wkb_hex
  
      # Use f-strings with extra characters and rounding precision
      if geos_version < (3, 13, 0):
          assert f"<{poly:.2f}>" == (
              "<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
              "-10.00 -0.00, -7.07 7.07, -0.00 10.00, 7.07 7.07, 10.00 0.00))>"
          )
      else:
          assert f"<{poly:.2f}>" == (
              "<POLYGON ((10.00 0.00, 7.07 -7.07, 0.00 -10.00, -7.07 -7.07, "
              "-10.00 0.00, -7.07 7.07, 0.00 10.00, 7.07 7.07, 10.00 0.00))>"
          )
  
      # 'g' format varies depending on GEOS version
      if geos_version < (3, 10, 0):
          assert f"{poly:.2G}" == (
              "POLYGON ((10 0, 7.1 -7.1, 1.6E-14 -10, -7.1 -7.1, "
              "-10 -3.2E-14, -7.1 7.1, -4.6E-14 10, 7.1 7.1, 10 0))"
          )
      else:
          assert f"{poly:.2G}" == (
              "POLYGON ((10 0, 7.07 -7.07, 0 -10, -7.07 -7.07, "
              "-10 0, -7.07 7.07, 0 10, 7.07 7.07, 10 0))"
          )
  
      # check empty
      empty = Polygon()
      assert f"{empty}" == "POLYGON EMPTY"
      assert format(empty, "") == empty.wkt
      assert format(empty, ".2G") == empty.wkt
      assert format(empty, "x") == empty.wkb_hex.lower()
      assert format(empty, "X") == empty.wkb_hex
  
imports: import pytest
  from shapely import Point, Polygon
  from shapely.geos import geos_version
label_desc: Use image node_id 4 for calling a global function with example usage: test_format_polygon() without return types