code: def test_series_nsmallest(data, n):
      """Indirectly tests Series.sort_values()"""
      sr = Series(data)
      psr = pd.Series(data)
      assert_eq(sr.nsmallest(n), psr.nsmallest(n))
      assert_eq(
          sr.nsmallest(n, keep="last").sort_index(),
          psr.nsmallest(n, keep="last").sort_index(),
      )
  
      assert_exceptions_equal(
          lfunc=psr.nsmallest,
          rfunc=sr.nsmallest,
          lfunc_args_and_kwargs=([], {"n": 3, "keep": "what"}),
          rfunc_args_and_kwargs=([], {"n": 3, "keep": "what"}),
      )
  
imports: import string
  from itertools import product
  import numpy
  import pandas
  import pytest
  from cudf import DataFrame, Series
  from cudf.core.column import NumericalColumn
  from cudf.testing._utils import DATETIME_TYPES, NUMERIC_TYPES, assert_eq, assert_exceptions_equal, expect_warning_if
label_desc: Use image node_id 8 for calling a global function with example usage: test_series_nsmallest(data, n) without return types