def test_check_biopepa_parser(self):
    """Simply check the parsing of a Bio-PEPA model"""
    my_source = """
        x = 1.0;
        y = 2.0 + 3.0;
        zz = 1 + 2 * 3;
        xy = x + y;
        ar = f(1) + g(2);
        f = f();
        g = g(1.0);
        h = h(1.0, 2.0);
        i = k(h(1.0));
        A = x >> ;
        B = y >> + x << ;
        A[0] <*> B[x + y]
        """
    biopepa_model = biopepa_parser.parse_model(my_source)
    
    expected_number_var_defs = 9
    actual_number_var_defs = len(biopepa_model.var_defs)
    self.assertEqual(expected_number_var_defs,
                     actual_number_var_defs)


    expected_number_of_comp_defs = 2
    actual_number_of_component_defs = len(biopepa_model.component_defs)
    self.assertEqual(expected_number_of_comp_defs, 
                     actual_number_of_component_defs)
def convert_source(source):
  """Converts the source of a Bio-PEPA model, represented as a string,
     into a string representing the LaTeX source
  """
  model = biopepa_parser.parse_model(source)
  outfile_imposter = utils.StringFile()
  translate_biopepa_model(model, outfile_imposter)
  return outfile_imposter.get_results()
def convert_source(source):
  """Converts the source of a Bio-PEPA model, represented as a string,
     into a string representing the SBML.
  """
  model = biopepa_parser.parse_model(source)
  outfile_imposter = utils.StringFile()
  sbml_document = translate_biopepa_model(model)
  sbml_ast.output_to_file(outfile_imposter, sbml_document)
  return outfile_imposter.get_results()