code: def test_sum_modulation_of_duplicate_events():
      """Test the function check_events when the paradigm contains
      duplicate events.
  
      """
      events = duplicate_events_paradigm()
  
      # Check that a warning is given to the user
      with pytest.warns(
          UserWarning, match="Duplicated events were detected."
      ):
          events_copy = handle_modulation_of_duplicate_events(events)
      assert_array_equal(
          events_copy["trial_type"], ["c0", "c0", "c0", "c1", "c1"]
      )
      assert_array_equal(events_copy["onset"], [10, 30, 70, 10, 30])
      assert_array_equal(
          events_copy["duration"], [1.0, 1.0, 1.0, 1.0, 1.0]
      )
      # Modulation was updated
      assert_array_equal(events_copy["modulation"], [1, 1, 2, 1, 1])
  
file_path: nilearn/nilearn/glm/tests/test_paradigm.py
imports: import os
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn._utils.data_gen import basic_paradigm
  from nilearn.glm.first_level.experimental_paradigm import check_events, handle_modulation_of_duplicate_events
  from ._testing import block_paradigm, design_with_nan_durations, design_with_nan_onsets, design_with_null_durations, duplicate_events_paradigm, modulated_block_paradigm, modulated_event_paradigm
label_desc: Use image node_id 8 for calling a global function with example usage: test_sum_modulation_of_duplicate_events() without return types