def test_reaction_formula_none_return(self): reaction = parse_reaction('A[e] + (6) B[c] <=> (6) C[e] + (6) D[c]') compound_formula = { 'A': Formula.parse('C6H12O6'), 'B': Formula.parse('O2'), 'C': Formula.parse('CO2'), } result = balancecheck.reaction_formula(reaction, compound_formula) self.assertIsNone(result)
def test_reaction_formula_normal_return(self): reaction = parse_reaction('A[e] + (6) B[c] <=> (6) C[e] + (6) D[c]') compound_formula = { 'A': Formula.parse('C6H12O6'), 'B': Formula.parse('O2'), 'C': Formula.parse('CO2'), 'D': Formula.parse('H2O') } left_form, right_form = balancecheck.reaction_formula( reaction, compound_formula) self.assertEqual(left_form, Formula.parse('C6H12O18')) self.assertEqual(right_form, Formula.parse('C6H12O18'))