code: def test_add_distribution(distributions):
      d1, d2, d3, d4, d12, d22, d32, d13 = distributions
  
      model = BayesianNetwork()
      assert len(model.distributions) == 0
      assert len(model.edges) == 0
      assert model._marginal_mapping == {}
      assert model._factor_mapping == {}
  
      assert len(model._factor_graph.factors) == 0
      assert len(model._factor_graph.marginals) == 0
      assert model._factor_graph._factor_idxs == {}
      assert model._factor_graph._factor_edges == []
      assert model._factor_graph._marginal_idxs == {}
      assert model._factor_graph._marginal_edges == []
  
      model.add_distribution(d1)
      assert len(model.distributions) == 1
      assert len(model.edges) == 0
      assert len(model._marginal_mapping) == 1
      assert len(model._factor_mapping) == 1
  
      assert len(model._factor_graph.factors) == 1
      assert len(model._factor_graph.marginals) == 1
      assert len(model._factor_graph._factor_idxs) == 1
      assert model._factor_graph._factor_edges == [[0]]
      assert len(model._factor_graph._marginal_idxs) == 1
      assert model._factor_graph._marginal_edges == [[0]]
  
      model.add_distribution(d12)
      assert len(model.distributions) == 2
      assert len(model.edges) == 0
      assert len(model._marginal_mapping) == 2
      assert len(model._factor_mapping) == 2
  
      assert len(model._factor_graph.factors) == 2
      assert len(model._factor_graph.marginals) == 2
      assert len(model._factor_graph._factor_idxs) == 2
      assert model._factor_graph._factor_edges == [[0], [1]]
      assert len(model._factor_graph._marginal_idxs) == 2
      assert model._factor_graph._marginal_edges == [[0], [1]]
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.bayesian_network import BayesianNetwork
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import ConditionalCategorical
  from nose.tools import assert_raises
  from numpy.testing import assert_array_equal
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 8 for calling a global function with example usage: test_add_distribution(distributions) without return types