code: def test_rows(unittest):
      import dtale.global_state as global_state
  
      global_state.clear_store()
      data_id, duplicates_type = "1", "rows"
      data = {data_id: duplicates_data()}
      build_data_inst(data)
  
      builder = DuplicateCheck(
          data_id, duplicates_type, {"keep": "first", "subset": "foo"}
      )
      unittest.assertEqual(
          builder.test(), dict(removed=0, total=5, remaining=5)
      )
      pre_length = len(data[data_id])
      new_data_id = builder.execute()
      assert pre_length == len(global_state.get_data(new_data_id))
  
      data = {data_id: duplicates_data()}
      build_data_inst(data)
  
      builder = DuplicateCheck(
          data_id,
          duplicates_type,
          {"keep": "first", "subset": ["foO", "bar"]},
      )
      unittest.assertEqual(
          builder.test(), dict(removed=3, total=5, remaining=2)
      )
      new_data_id = builder.execute()
      assert len(global_state.get_data(new_data_id)) == 2
      unittest.assertEqual(
          global_state.get_data(new_data_id)["Foo"].tolist(), [1, 4]
      )
  
      data = {data_id: duplicates_data()}
      build_data_inst(data)
  
      builder = DuplicateCheck(
          data_id,
          duplicates_type,
          {"keep": "last", "subset": ["foO", "bar"]},
      )
      unittest.assertEqual(
          builder.test(), dict(removed=3, total=5, remaining=2)
      )
      new_data_id = builder.execute()
      assert len(global_state.get_data(new_data_id)) == 2
      unittest.assertEqual(
          global_state.get_data(new_data_id)["Foo"].tolist(), [3, 5]
      )
  
      data = {data_id: duplicates_data()}
      build_data_inst(data)
  
      builder = DuplicateCheck(
          data_id,
          duplicates_type,
          {"keep": "none", "subset": ["foO", "bar"]},
      )
      unittest.assertEqual(
          builder.test(), dict(removed=5, total=5, remaining=0)
      )
      with pytest.raises(RemoveAllDataException):
          builder.execute()
  
file_path: dtale/tests/dtale/test_duplicates.py
imports: import json
  import pandas
  import pytest
  from dtale.duplicate_checks import DuplicateCheck, NoDuplicatesException, NoDuplicatesToShowException, RemoveAllDataException
  from tests.dtale.test_views import app
  from tests.dtale import build_data_inst, build_dtypes
label_desc: Use image node_id 5 for calling a global function with example usage: test_rows(unittest) without return types