code: def test_fit(X, shapes, rates):
      d = Gamma(shapes, rates)
      d.fit(X)
      assert_raises(
          AssertionError, assert_array_almost_equal, shapes, d.shapes
      )
  
      for param1, param2 in (shapes, rates), (None, None):
          d = Gamma(param1, param2)
          d.fit(X[:4])
          _test_fit_params(
              d,
              [2.599745, 1.681025, 3.453269],
              [1.704751, 1.222564, 2.227916],
              [1.029533, 0.437424, 1.616514],
          )
  
          d.fit(X[4:])
          _test_fit_params(
              d,
              [7.692329, 14.423422, 0.571159],
              [2.097908, 10.302444, 0.389426],
              [-2.211836, 9.980053, -0.98287],
          )
  
          d = Gamma(param1, param2)
          d.fit(X)
          _test_fit_params(
              d,
              [2.231407, 2.637839, 1.037289],
              [0.913441, 1.903595, 0.685002],
              [-0.316346, 1.31193, -0.372041],
          )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Gamma
  from ._utils import _test_initialization_raises_two_parameters
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_efd_from_summaries
  from ._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 36 for calling a global function with example usage: test_fit(X, shapes, rates) without return types