code: def test_nearest_max_distance(
      self, expected, max_distance, return_all, return_distance
  ):
      geoms = shapely.points(np.arange(10), np.arange(10))
      df = geopandas.GeoDataFrame({"geometry": geoms})
  
      ps = [Point(0.5, 0.5), Point(0, 10)]
      res = df.sindex.nearest(
          ps,
          return_all=return_all,
          max_distance=max_distance,
          return_distance=return_distance,
      )
      if return_distance:
          assert_array_equal(res[0], expected[0])
          assert_array_equal(res[1], expected[1])
      else:
          assert_array_equal(res, expected[0])
  
imports: from math import sqrt
  import numpy
  import pandas
  import pytest
  import shapely
  from numpy.testing import assert_array_equal
  from shapely.geometry import GeometryCollection, LineString, MultiPolygon, Point, Polygon, box
  import geopandas
  from geopandas import GeoDataFrame, GeoSeries, read_file
  from geopandas import _compat
label_desc: Use image node_id 23 for calling the TestShapelyInterface obj's underlying member method code with example usage: obj.test_nearest_max_distance(expected, max_distance, return_all, return_distance) without return types