code: def test_size(df, by):
      grouped = df.groupby(by=by)
      result = grouped.size()
      for key, group in grouped:
          assert result[key] == len(group)
  
file_path: pandas/pandas/tests/groupby/methods/test_size.py
imports: import numpy
  import pytest
  import pandas.util._test_decorators
  from pandas.core.dtypes.common import is_integer_dtype
  from pandas import DataFrame, Index, PeriodIndex, Series
  import pandas._testing
label_desc: Use image node_id 1 for calling a global function with example usage: test_size(df, by) without return types