docstr: Test vs. manually computed results for modes not in numpy's pad.
docstr_tok: ["Test","vs.","manually","computed","results","for","modes","not","in","numpy","'s","pad","."]
code: def test_extensions(self, mode):
      """Test vs. manually computed results for modes not in numpy's pad."""
      x = np.array([1, 2, 3, 1], dtype=float)
      npre, npost = 6, 6
      y = _pad_test(x, npre=npre, npost=npost, mode=mode)
      if mode == "antisymmetric":
          y_expected = np.asarray(
              [3, 1, -1, -3, -2, -1, 1, 2, 3, 1, -1, -3, -2, -1, 1, 2]
          )
      elif mode == "antireflect":
          y_expected = np.asarray(
              [1, 2, 3, 1, -1, 0, 1, 2, 3, 1, -1, 0, 1, 2, 3, 1]
          )
      elif mode == "smooth":
          y_expected = np.asarray(
              [
                  -5,
                  -4,
                  -3,
                  -2,
                  -1,
                  0,
                  1,
                  2,
                  3,
                  1,
                  -1,
                  -3,
                  -5,
                  -7,
                  -9,
                  -11,
              ]
          )
      elif mode == "line":
          lin_slope = (x[-1] - x[0]) / (len(x) - 1)
          left = x[0] + np.arange(-npre, 0, 1) * lin_slope
          right = x[-1] + np.arange(1, npost + 1) * lin_slope
          y_expected = np.concatenate((left, x, right))
      else:
          y_expected = np.pad(x, (npre, npost), mode=mode)
      assert_allclose(y, y_expected)
  
imports: import numpy
  from itertools import product
  from numpy.testing import assert_equal, assert_allclose
  from pytest import raises
  import pytest
  from scipy.signal import upfirdn, firwin
  from scipy.signal._upfirdn import _output_len, _upfirdn_modes
  from scipy.signal._upfirdn_apply import _pad_test
label_desc: Use image node_id 9 for calling the TestUpfirdn obj's underlying member method code with example usage: obj.test_extensions(mode) without return types