code: def test_agg_callables():
      # GH 7929
      df = DataFrame({"foo": [1, 2], "bar": [3, 4]}).astype(np.int64)
  
      class fn_class:
          def __call__(self, x):
              return sum(x)
  
      equiv_callables = [
          sum,
          np.sum,
          lambda x: sum(x),
          lambda x: x.sum(),
          partial(sum),
          fn_class(),
      ]
  
      expected = df.groupby("foo").agg("sum")
      for ecall in equiv_callables:
          warn = (
              FutureWarning if ecall is sum or ecall is np.sum else None
          )
          msg = "using DataFrameGroupBy.sum"
          with tm.assert_produces_warning(warn, match=msg):
              result = df.groupby("foo").agg(ecall)
          tm.assert_frame_equal(result, expected)
  
imports: import datetime
  from functools import partial
  import numpy
  import pytest
  from pandas.errors import SpecificationError
  import pandas
  from pandas import DataFrame, Index, MultiIndex, PeriodIndex, Series, date_range, period_range
  import pandas._testing
  from pandas.io.formats.printing import pprint_thing
label_desc: Use image node_id 15 for calling a global function with example usage: test_agg_callables() and returns: sum