code: def test_groupby_sample_invalid_n_raises(n):
      df = DataFrame({"a": [1, 2], "b": [1, 2]})
  
      if n < 0:
          msg = "A negative number of rows requested. Please provide `n` >= 0."
      else:
          msg = "Only integers accepted as `n` values"
  
      with pytest.raises(ValueError, match=msg):
          df.groupby("a").sample(n=n)
  
      with pytest.raises(ValueError, match=msg):
          df.groupby("a")["b"].sample(n=n)
  
file_path: pandas/pandas/tests/groupby/methods/test_sample.py
imports: import pytest
  from pandas import DataFrame, Index, Series
  import pandas._testing
label_desc: Use image node_id 6 for calling a global function with example usage: test_groupby_sample_invalid_n_raises(n) without return types