code: def test_base_hmm_attributes():
      n_components = 20
      startprob = np.random.random(n_components)
      startprob /= startprob.sum()
      transmat = np.random.random((n_components, n_components))
      transmat /= np.tile(
          transmat.sum(axis=1)[:, np.newaxis], (1, n_components)
      )
  
      h = StubHMM(n_components)
  
      assert h.n_components == n_components
  
      h.startprob_ = startprob
      assert_allclose(h.startprob_, startprob)
  
      with pytest.raises(ValueError):
          h.startprob_ = 2 * startprob
          h._check()
      with pytest.raises(ValueError):
          h.startprob_ = []
          h._check()
      with pytest.raises(ValueError):
          h.startprob_ = np.zeros((n_components - 2, 2))
          h._check()
  
      h.startprob_ = startprob
      h.transmat_ = transmat
      assert_allclose(h.transmat_, transmat)
      with pytest.raises(ValueError):
          h.transmat_ = 2 * transmat
          h._check()
      with pytest.raises(ValueError):
          h.transmat_ = []
          h._check()
      with pytest.raises(ValueError):
          h.transmat_ = np.zeros((n_components - 2, n_components))
          h._check()
  
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  from scipy import special
  from hmmlearn.base import BaseHMM, ConvergenceMonitor
  from hmmlearn import _hmmc
label_desc: Use image node_id 1 for calling a global function with example usage: test_base_hmm_attributes() without return types