def _getMolecules(self): """ :return dict: key is species name, value is species object """ molecules = [] for reaction in self.reactions: molecules.extend( MoleculeStoichiometry.getMolecules(reaction.reactants)) molecules.extend( MoleculeStoichiometry.getMolecules(reaction.products)) return util.uniqueify(molecules)
def testGetMolecules(self): if IGNORE_TEST: return names = ["a", "b", "c"] full_names = list(names) full_names.extend(names) m_ss = [MoleculeStoichiometry(Molecule(n), NUM1) for n in full_names] molecules = MoleculeStoichiometry.getMolecules(m_ss) self.assertEqual(len(molecules), len(names))