docstr: Verify that argument validation works as intended.
docstr_tok: ["Verify","that","argument","validation","works","as","intended","."]
code: def test_exceptions(self):
      """
      Verify that argument validation works as intended.
      """
      with raises(ValueError, match="1D array"):
          # x with dimension > 1
          peak_widths(np.zeros((3, 4)), np.ones(3))
      with raises(ValueError, match="1D array"):
          # x with dimension < 1
          peak_widths(3, [0])
      with raises(ValueError, match="1D array"):
          # peaks with dimension > 1
          peak_widths(np.arange(10), np.ones((3, 2), dtype=np.intp))
      with raises(ValueError, match="1D array"):
          # peaks with dimension < 1
          peak_widths(np.arange(10), 3)
      with raises(ValueError, match="not a valid index"):
          # peak pos exceeds x.size
          peak_widths(np.arange(10), [8, 11])
      with raises(ValueError, match="not a valid index"):
          # empty x with peaks supplied
          peak_widths([], [1, 2])
      with raises(TypeError, match="cannot safely cast"):
          # peak cannot be safely casted to intp
          peak_widths(np.arange(10), [1.1, 2.3])
      with raises(ValueError, match="rel_height"):
          # rel_height is < 0
          peak_widths([0, 1, 0, 1, 0], [1, 3], rel_height=-1)
      with raises(TypeError, match="None"):
          # prominence data contains None
          peak_widths(
              [1, 2, 1], [1], prominence_data=(None, None, None)
          )
  
imports: from __future__ import division, print_function, absolute_import
  import copy
  import numpy
  from numpy.testing import assert_, assert_equal, assert_allclose, assert_array_equal
  import pytest
  from pytest import raises, warns
  from scipy._lib.six import xrange
  from scipy.signal._peak_finding import argrelmax, argrelmin, peak_prominences, peak_widths, _unpack_condition_args, find_peaks, find_peaks_cwt, _identify_ridge_lines
  from scipy.signal._peak_finding_utils import _local_maxima_1d, PeakPropertyWarning
label_desc: Use image node_id 4 for calling the TestPeakWidths obj's underlying member method code with example usage: obj.test_exceptions() without return types