code: def test_invalid_args(self):
      # `freq` and `gain` have different lengths.
      assert_raises(ValueError, firwin2, 50, [0, 0.5, 1], [0.0, 1.0])
      # `nfreqs` is less than `ntaps`.
      assert_raises(
          ValueError,
          firwin2,
          50,
          [0, 0.5, 1],
          [0.0, 1.0, 1.0],
          nfreqs=33,
      )
      # Decreasing value in `freq`
      assert_raises(
          ValueError,
          firwin2,
          50,
          [0, 0.5, 0.4, 1.0],
          [0, 0.25, 0.5, 1.0],
      )
      # Value in `freq` repeated more than once.
      assert_raises(
          ValueError,
          firwin2,
          50,
          [0, 0.1, 0.1, 0.1, 1.0],
          [0.0, 0.5, 0.75, 1.0, 1.0],
      )
      # `freq` does not start at 0.0.
      assert_raises(ValueError, firwin2, 50, [0.5, 1.0], [0.0, 1.0])
  
      # Type II filter, but the gain at nyquist frequency is not zero.
      assert_raises(
          ValueError, firwin2, 16, [0.0, 0.5, 1.0], [0.0, 1.0, 1.0]
      )
  
      # Type III filter, but the gains at nyquist and zero rate are not zero.
      assert_raises(
          ValueError,
          firwin2,
          17,
          [0.0, 0.5, 1.0],
          [0.0, 1.0, 1.0],
          antisymmetric=True,
      )
      assert_raises(
          ValueError,
          firwin2,
          17,
          [0.0, 0.5, 1.0],
          [1.0, 1.0, 0.0],
          antisymmetric=True,
      )
      assert_raises(
          ValueError,
          firwin2,
          17,
          [0.0, 0.5, 1.0],
          [1.0, 1.0, 1.0],
          antisymmetric=True,
      )
  
      # Type VI filter, but the gain at zero rate is not zero.
      assert_raises(
          ValueError,
          firwin2,
          16,
          [0.0, 0.5, 1.0],
          [1.0, 1.0, 0.0],
          antisymmetric=True,
      )
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_equal, assert_, assert_allclose, assert_warns
  from pytest import raises
  from scipy.special import sinc
  from scipy.signal import kaiser_beta, kaiser_atten, kaiserord, firwin, firwin2, freqz, remez, firls, minimum_phase
label_desc: Use image node_id 1 for calling the TestFirwin2 obj's underlying member method code with example usage: obj.test_invalid_args() without return types