code: def test_diagnostics():
      mod, res = get_dummy_mod()
  
      # Override the standardized forecasts errors to get more reasonable values
      # for the tests to run (not necessary, but prevents some annoying warnings)
      shape = res.filter_results._standardized_forecasts_error.shape
      res.filter_results._standardized_forecasts_error = (
          np.random.normal(size=shape)
      )
  
      # Make sure method=None selects the appropriate test
      actual = res.test_normality(method=None)
      desired = res.test_normality(method="jarquebera")
      assert_allclose(actual, desired)
  
      assert_raises(
          NotImplementedError, res.test_normality, method="invalid"
      )
  
      actual = res.test_heteroskedasticity(method=None)
      desired = res.test_heteroskedasticity(method="breakvar")
      assert_allclose(actual, desired)
  
      with pytest.raises(ValueError):
          res.test_heteroskedasticity(
              method=None, alternative="invalid"
          )
      with pytest.raises(NotImplementedError):
          res.test_heteroskedasticity(method="invalid")
  
      actual = res.test_serial_correlation(method=None)
      desired = res.test_serial_correlation(method="ljungbox")
      assert_allclose(actual, desired)
  
      with pytest.raises(NotImplementedError):
          res.test_serial_correlation(method="invalid")
  
      # Smoke tests for other options
      res.test_heteroskedasticity(
          method=None, alternative="d", use_f=False
      )
      res.test_serial_correlation(method="boxpierce")
  
imports: from statsmodels.compat.pandas import MONTH_END
  import os
  import re
  import warnings
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_almost_equal, assert_equal, assert_raises
  import pandas
  import pytest
  from statsmodels.datasets import nile
  from statsmodels.tsa.statespace import kalman_filter, kalman_smoother, sarimax, varmax
  from statsmodels.tsa.statespace.mlemodel import MLEModel, MLEResultsWrapper
  from statsmodels.tsa.statespace.tests.results import results_sarimax, results_var_misc
label_desc: Use image node_id 22 for calling a global function with example usage: test_diagnostics() without return types