code: def test_groupby(df):
      # counts work fine
      res = df.groupby("value2").count()
      exp = pd.DataFrame(
          {"geometry": [2, 1], "value1": [2, 1], "value2": [1, 2]}
      ).set_index("value2")
      assert_frame_equal(res, exp)
  
      # reductions ignore geometry column
      if not compat.PANDAS_GE_20:
          res = df.groupby("value2").sum()
      else:
          res = df.groupby("value2").sum(numeric_only=True)
      exp = pd.DataFrame(
          {"value1": [2, 1], "value2": [1, 2]}, dtype="int64"
      ).set_index("value2")
      assert_frame_equal(res, exp)
  
      # applying on the geometry column
      res = df.groupby("value2")["geometry"].apply(
          lambda x: x.union_all()
      )
  
      exp = GeoSeries(
          [shapely.geometry.MultiPoint([(0, 0), (2, 2)]), Point(1, 1)],
          index=pd.Index([1, 2], name="value2"),
          name="geometry",
      )
      assert_series_equal(res, exp)
  
      # apply on geometry column not resulting in new geometry
      res = df.groupby("value2")["geometry"].apply(
          lambda x: x.union_all().area
      )
      exp = pd.Series(
          [0.0, 0.0],
          index=pd.Index([1, 2], name="value2"),
          name="geometry",
      )
  
      assert_series_equal(res, exp)
  
imports: import os
  from packaging.version import Version
  import warnings
  import numpy
  from numpy.testing import assert_array_equal
  import pandas
  import shapely
  from shapely.geometry import Point, GeometryCollection, LineString, LinearRing
  import geopandas
  from geopandas import GeoDataFrame, GeoSeries
  import geopandas._compat
  from geopandas.array import from_shapely
  from geopandas.testing import assert_geodataframe_equal, assert_geoseries_equal
  from pandas.testing import assert_frame_equal, assert_series_equal
  import pytest
label_desc: Use image node_id 35 for calling a global function with example usage: test_groupby(df) without return types