code: def test_count(test_series):
      test_series[::3] = np.nan
  
      expected = test_series.groupby(lambda x: x.year).count()
  
      grouper = Grouper(freq="YE", label="right", closed="right")
      result = test_series.groupby(grouper).count()
      expected.index = result.index
      tm.assert_series_equal(result, expected)
  
      result = test_series.resample("YE").count()
      expected.index = result.index
      tm.assert_series_equal(result, expected)
  
imports: from datetime import datetime
  from operator import methodcaller
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, Series, Timestamp
  import pandas._testing
  from pandas.core.groupby.grouper import Grouper
  from pandas.core.indexes.datetimes import date_range
label_desc: Use image node_id 3 for calling a global function with example usage: test_count(test_series) without return types