code: def test_polyval(self):
      # check empty input
      assert_equal(poly.polyval([], [1]).size, 0)
  
      # check normal input)
      x = np.linspace(-1, 1)
      y = [x**i for i in range(5)]
      for i in range(5):
          tgt = y[i]
          res = poly.polyval(x, [0] * i + [1])
          assert_almost_equal(res, tgt)
      tgt = x * (x**2 - 1)
      res = poly.polyval(x, [0, -1, 0, 1])
      assert_almost_equal(res, tgt)
  
      # check that shape is preserved
      for i in range(3):
          dims = [2] * i
          x = np.zeros(dims)
          assert_equal(poly.polyval(x, [1]).shape, dims)
          assert_equal(poly.polyval(x, [1, 0]).shape, dims)
          assert_equal(poly.polyval(x, [1, 0, 0]).shape, dims)
  
      # check masked arrays are processed correctly
      mask = [False, True, False]
      mx = np.ma.array([1, 2, 3], mask=mask)
      res = np.polyval([7, 5, 3], mx)
      assert_array_equal(res.mask, mask)
  
      # check subtypes of ndarray are preserved
      class C(np.ndarray):
          pass
  
      cx = np.array([1, 2, 3]).view(C)
      assert_equal(type(np.polyval([2, 3, 4], cx)), C)
  
imports: from functools import reduce
  from fractions import Fraction
  import numpy
  import numpy.polynomial.polynomial
  import pickle
  from copy import deepcopy
  from numpy.testing import assert_almost_equal, assert_raises, assert_equal, assert_, assert_array_equal, assert_raises_regex
label_desc: Use image node_id 1 for calling the TestEvaluation obj's underlying member method code with example usage: obj.test_polyval() without return types