code: def test_agg_cast_results_dtypes():
      # similar to GH12821
      # xref #11444
      u = [dt.datetime(2015, x + 1, 1) for x in range(12)]
      v = list("aaabbbbbbccd")
      df = DataFrame({"X": v, "Y": u})
  
      result = df.groupby("X")["Y"].agg(len)
      expected = df.groupby("X")["Y"].count()
      tm.assert_series_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 5 for calling a global function with example usage: test_agg_cast_results_dtypes() without return types