code: def test_methods_nunique(test_frame):
      # series only
      g = test_frame.groupby("A")
      r = g.resample("2s")
      result = r.B.nunique()
      expected = g.B.apply(lambda x: x.resample("2s").nunique())
      tm.assert_series_equal(result, expected)
  
imports: from textwrap import dedent
  import numpy
  import pytest
  from pandas.compat import is_platform_windows
  import pandas
  from pandas import DataFrame, Index, Series, TimedeltaIndex, Timestamp
  import pandas._testing
  from pandas.core.indexes.datetimes import date_range
label_desc: Use image node_id 10 for calling a global function with example usage: test_methods_nunique(test_frame) without return types