code: def test_check_events_warnings():
      """Test the function which tests that the events
      data describes a valid experimental paradigm.
      """
      events = basic_paradigm()
      # Warnings checkins
      # Missing trial type
      events = events.drop(columns=["trial_type"])
      with pytest.warns(
          UserWarning, match="'trial_type' column not found"
      ):
          events_copy = check_events(events)
  
      # Check that missing trial type yields a 'dummy' array
      assert len(np.unique(events_copy["trial_type"])) == 1
      assert events_copy["trial_type"][0] == "dummy"
  
      # An unexpected field is provided
      events["foo"] = np.zeros(len(events))
      with pytest.warns(
          UserWarning,
          match=(
              "The following unexpected columns "
              "in events data will be ignored: foo"
          ),
      ):
          events_copy2 = check_events(events)
  
      assert_array_equal(
          events_copy["trial_type"], events_copy2["trial_type"]
      )
      assert_array_equal(events_copy["onset"], events_copy2["onset"])
      assert_array_equal(
          events_copy["duration"], events_copy2["duration"]
      )
      assert_array_equal(
          events_copy["modulation"], events_copy2["modulation"]
      )
  
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 3 for calling a global function with example usage: test_check_events_warnings() without return types