def test_to_infix_2(self): sequence = [1, 2, '+', 3, '*', 4, '+', 5, '/'] sf = SuffixFormula() for s in sequence: sf.push(s) self.assertEqual(sf.to_infix(), "(4 + (3 * (1 + 2))) / 5")
def test_to_infix_1(self): sequence = [1, 2, 3, 4, '*', '*', '*'] sf = SuffixFormula() for s in sequence: sf.push(s) self.assertEqual(sf.to_infix(), "1 * (2 * (3 * 4))")