code: def test_farthest_points_closest_points():
      from sympy.core.random import randint
      from sympy.utilities.iterables import subsets
  
      for how in (min, max):
          if how == min:
              func = closest_points
          else:
              func = farthest_points
  
          raises(ValueError, lambda: func(Point2D(0, 0), Point2D(0, 0)))
  
          # 3rd pt dx is close and pt is closer to 1st pt
          p1 = [Point2D(0, 0), Point2D(3, 0), Point2D(1, 1)]
          # 3rd pt dx is close and pt is closer to 2nd pt
          p2 = [Point2D(0, 0), Point2D(3, 0), Point2D(2, 1)]
          # 3rd pt dx is close and but pt is not closer
          p3 = [Point2D(0, 0), Point2D(3, 0), Point2D(1, 10)]
          # 3rd pt dx is not closer and it's closer to 2nd pt
          p4 = [Point2D(0, 0), Point2D(3, 0), Point2D(4, 0)]
          # 3rd pt dx is not closer and it's closer to 1st pt
          p5 = [Point2D(0, 0), Point2D(3, 0), Point2D(-1, 0)]
          # duplicate point doesn't affect outcome
          dup = [
              Point2D(0, 0),
              Point2D(3, 0),
              Point2D(3, 0),
              Point2D(-1, 0),
          ]
          # symbolic
          x = Symbol("x", positive=True)
          s = [Point2D(a) for a in ((x, 1), (x + 3, 2), (x + 2, 2))]
  
          for points in (p1, p2, p3, p4, p5, dup, s):
              d = how(i.distance(j) for i, j in subsets(set(points), 2))
              ans = a, b = list(func(*points))[0]
              assert a.distance(b) == d
              assert ans == _ordered_points(ans)
  
          # if the following ever fails, the above tests were not sufficient
          # and the logical error in the routine should be fixed
          points = set()
          while len(points) != 7:
              points.add(Point2D(randint(1, 100), randint(1, 100)))
          points = list(points)
          d = how(i.distance(j) for i, j in subsets(points, 2))
          ans = a, b = list(func(*points))[0]
          assert a.distance(b) == d
          assert ans == _ordered_points(ans)
  
      # equidistant points
      a, b, c = (
          Point2D(0, 0),
          Point2D(1, 0),
          Point2D(S.Half, sqrt(3) / 2),
      )
      ans = {_ordered_points((i, j)) for i, j in subsets((a, b, c), 2)}
      assert closest_points(b, c, a) == ans
      assert farthest_points(b, c, a) == ans
  
      # unique to farthest
      points = [(1, 1), (1, 2), (3, 1), (-5, 2), (15, 4)]
      assert farthest_points(*points) == {
          (Point2D(-5, 2), Point2D(15, 4))
      }
      points = [(1, -1), (1, -2), (3, -1), (-5, -2), (15, -4)]
      assert farthest_points(*points) == {
          (Point2D(-5, -2), Point2D(15, -4))
      }
      assert farthest_points((1, 1), (0, 0)) == {
          (Point2D(0, 0), Point2D(1, 1))
      }
      raises(ValueError, lambda: farthest_points((1, 1)))
  
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 5 for calling a global function with example usage: test_farthest_points_closest_points() without return types