code: def test_centroid():
      p = Polygon((0, 0), (10, 0), (10, 10))
      q = p.translate(0, 20)
      assert centroid(p, q) == Point(20, 40) / 3
      p = Segment((0, 0), (2, 0))
      q = Segment((0, 0), (2, 2))
      assert centroid(p, q) == Point(1, -sqrt(2) + 2)
      assert centroid(Point(0, 0), Point(2, 0)) == Point(2, 0) / 2
      assert (
          centroid(Point(0, 0), Point(0, 0), Point(2, 0))
          == Point(2, 0) / 3
      )
  
file_path: sympy/sympy/geometry/tests/test_util.py
imports: import pytest
  from sympy.core.numbers import Float
  from sympy.core.function import Derivative, Function
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol
  from sympy.functions import exp, cos, sin, tan, cosh, sinh
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.geometry import Point, Point2D, Line, Polygon, Segment, convex_hull, intersection, centroid, Point3D, Line3D, Ray, Ellipse
  from sympy.geometry.util import idiff, closest_points, farthest_points, _ordered_points, are_coplanar
  from sympy.solvers.solvers import solve
  from sympy.testing.pytest import raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_centroid() without return types