code: def test_duplicated_subset(subset, keep):
      df = DataFrame(
          {
              "A": [0, 1, 1, 2, 0],
              "B": ["a", "b", "b", "c", "a"],
              "C": [np.nan, 3, 3, None, np.nan],
          }
      )
  
      if subset is None:
          subset = list(df.columns)
      elif isinstance(subset, str):
          # need to have a DataFrame, not a Series
          # -> select columns with singleton list, not string
          subset = [subset]
  
      expected = df[subset].duplicated(keep=keep)
      result = df.duplicated(keep=keep, subset=subset)
      tm.assert_series_equal(result, expected)
  
file_path: pandas/pandas/tests/frame/methods/test_duplicated.py
imports: import re
  import sys
  import numpy
  import pytest
  from pandas import DataFrame, Series, date_range
  import pandas._testing
label_desc: Use image node_id 5 for calling a global function with example usage: test_duplicated_subset(subset, keep) without return types