code: def test_sample(self, implementation, n_samples=1000):
      h = self.new_hmm(implementation)
      X, state_sequence = h.sample(n_samples)
      assert X.ndim == 2
      assert len(X) == len(state_sequence) == n_samples
      assert len(np.unique(X)) == self.n_trials + 1
      assert (X.sum(axis=1) == self.n_trials).all()
      h.n_trials = None
      with pytest.raises(ValueError):
          h.sample(n_samples)
      h.n_trials = [1, 2, 3]
      with pytest.raises(ValueError):
          h.sample(n_samples)
  
file_path: hmmlearn/lib/hmmlearn/tests/test_multinomial_hmm.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  from hmmlearn import hmm
  from .None import assert_log_likelihood_increasing, normalized
label_desc: Use image node_id 4 for calling the TestMultinomialHMM obj's underlying member method code with example usage: obj.test_sample(implementation, n_samples) without return types