code: def test_invalid_arguments():
      """Test error messages raised by invalid arguments."""
      n_ch, n_times = 2, 100
      data = np.random.RandomState(0).randn(n_ch, n_times)
      info = create_info(n_ch, 100.0, "eeg")
      raw = RawArray(data, info, first_samp=0)
  
      # negative floats PTP
      with pytest.raises(
          ValueError,
          match="Argument 'flat' should define a positive "
          "threshold. Provided: '-1'.",
      ):
          annotate_amplitude(raw, peak=None, flat=-1)
      with pytest.raises(
          ValueError,
          match="Argument 'peak' should define a positive "
          "threshold. Provided: '-1'.",
      ):
          annotate_amplitude(raw, peak=-1, flat=None)
  
      # negative PTP threshold for one channel type
      with pytest.raises(
          ValueError,
          match="Argument 'flat' should define positive "
          "thresholds. Provided for channel type "
          "'eog': '-1'.",
      ):
          annotate_amplitude(raw, peak=None, flat=dict(eeg=1, eog=-1))
      with pytest.raises(
          ValueError,
          match="Argument 'peak' should define positive "
          "thresholds. Provided for channel type "
          "'eog': '-1'.",
      ):
          annotate_amplitude(raw, peak=dict(eeg=1, eog=-1), flat=None)
  
      # test both PTP set to None
      with pytest.raises(
          ValueError,
          match="At least one of the arguments 'peak' or 'flat' "
          "must not be None.",
      ):
          annotate_amplitude(raw, peak=None, flat=None)
  
      # bad_percent outside [0, 100]
      with pytest.raises(
          ValueError,
          match="Argument 'bad_percent' should define a "
          "percentage between 0% and 100%. Provided: "
          "-1.0%.",
      ):
          annotate_amplitude(
              raw, peak=dict(eeg=1), flat=None, bad_percent=-1
          )
  
      # min_duration negative
      with pytest.raises(
          ValueError,
          match="Argument 'min_duration' should define a "
          "positive duration in seconds. Provided: "
          "'-1.0' seconds.",
      ):
          annotate_amplitude(
              raw, peak=dict(eeg=1), flat=None, min_duration=-1
          )
  
      # min_duration equal to the raw duration
      with pytest.raises(
          ValueError,
          match=re.escape(
              "Argument 'min_duration' should define a "
              "positive duration in seconds shorter than the "
              "raw duration (1.0 seconds). Provided: "
              "'1.0' seconds."
          ),
      ):
          annotate_amplitude(
              raw, peak=dict(eeg=1), flat=None, min_duration=1.0
          )
  
      # min_duration longer than the raw duration
      with pytest.raises(
          ValueError,
          match=re.escape(
              "Argument 'min_duration' should define a "
              "positive duration in seconds shorter than the "
              "raw duration (1.0 seconds). Provided: "
              "'10.0' seconds."
          ),
      ):
          annotate_amplitude(
              raw, peak=dict(eeg=1), flat=None, min_duration=10
          )
  
file_path: mne-python/mne/preprocessing/tests/test_annotate_amplitude.py
imports: import datetime
  import itertools
  import re
  from pathlib import Path
  import numpy
  import pytest
  from mne import create_info
  from mne.annotations import Annotations
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.preprocessing import annotate_amplitude
label_desc: Use image node_id 6 for calling a global function with example usage: test_invalid_arguments() without return types