code: def test_ewma_update(self, lam):
      nobs, resids = self.nobs, self.resids
      sigma2, backcast = self.sigma2, self.backcast
      if lam is None:
          parameters = np.array([0.9])
      else:
          parameters = np.empty(0)
      sigma2[:] = np.nan
      eu = recpy.EWMAUpdater(lam)
      eu.initialize_update(parameters, backcast, nobs)
      for t in range(nobs):
          eu.update(t, parameters, resids, sigma2, self.var_bounds)
          if t == nobs // 2:
              eu = pickle.loads(pickle.dumps(eu))
      eu.initialize_update(parameters, backcast, nobs)
      sigma2_ref = sigma2.copy()
  
      sigma2[:] = np.nan
      eu = rec.EWMAUpdater(lam)
      eu.initialize_update(parameters, backcast, nobs)
      for t in range(nobs):
          eu._update_tester(
              t, parameters, resids, sigma2, self.var_bounds
          )
          if t == nobs // 2:
              eu = pickle.loads(pickle.dumps(eu))
      eu.initialize_update(parameters, backcast, nobs)
      assert_allclose(sigma2, sigma2_ref)
  
      sigma2[:] = np.nan
      gu = rec.GARCHUpdater(1, 0, 1, 2.0)
      _lam = 0.9 if lam is None else lam
      parameters = np.array([0, 1 - _lam, _lam])
      gu.initialize_update(parameters, backcast, nobs)
      for t in range(nobs):
          gu._update_tester(
              t, parameters, resids, sigma2, self.var_bounds
          )
      gu.initialize_update(parameters, backcast, nobs)
      assert_allclose(sigma2, sigma2_ref)
  
imports: import os
  import pickle
  import timeit
  import types
  import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose, assert_almost_equal
  import pytest
  from scipy.special import gamma
  import arch.univariate.recursions_python
  from arch.univariate.volatility import RiskMetrics2006
label_desc: Use image node_id 26 for calling the TestRecursions obj's underlying member method code with example usage: obj.test_ewma_update(lam) without return types