code: def test_fit_shapes():
      K = 5
      V = 3
      T = 10
      es = EventSegment(K, n_iter=2)
      sample_data = np.random.rand(V, T)
      es.fit(sample_data.T)
  
      assert es.segments_[0].shape == (T, K), (
          "Segmentation from fit " "has incorrect shape"
      )
      assert np.isclose(
          np.sum(es.segments_[0], axis=1), np.ones(T)
      ).all(), "Segmentation from learn_events not correctly normalized"
  
      T2 = 15
      sample_data2 = np.random.rand(V, T2)
      test_segments, test_ll = es.find_events(sample_data2.T)
  
      assert test_segments.shape == (T2, K), (
          "Segmentation from find_events " "has incorrect shape"
      )
      assert np.isclose(
          np.sum(test_segments, axis=1), np.ones(T2)
      ).all(), "Segmentation from find_events not correctly normalized"
  
      es_invalid = EventSegment(K)
      with pytest.raises(ValueError):
          es_invalid.model_prior(K - 1)
          # ``with`` block is about to end with no error.
          pytest.fail("T < K should cause error")
      with pytest.raises(ValueError):
          es_invalid.set_event_patterns(np.zeros((V, K - 1)))
          pytest.fail("#Events < K should cause error")
  
file_path: brainiak/tests/eventseg/test_event.py
imports: from brainiak.eventseg.event import EventSegment
  from scipy.special import comb
  import numpy
  import pytest
  from sklearn.exceptions import NotFittedError
label_desc: Use image node_id 2 for calling a global function with example usage: test_fit_shapes() without return types