Exemplo n.º 1
0
 def test_can_deal_with_parentheses(self):
     task1 = "5 + ((1 + 2) * 4) - 3"
     self.assertEqual(infix2postfix(task1), "5 1 2 + 4 * + 3 -")
     task2 = "(5 + 3) * 12 / 3"
     self.assertEqual(infix2postfix(task2), "5 3 + 12 * 3 /")
Exemplo n.º 2
0
 def test_can_deal_with_multiple_operators(self):
     self.assertEqual(infix2postfix("2 + 3*5"), "2 3 5 * +")
Exemplo n.º 3
0
 def test_returns_correct_result(self):
     self.assertEqual(infix2postfix("2 + 3"), "2 3 +")
Exemplo n.º 4
0
 def test_can_deal_with_parentheses(self):
     task1 = '5 + ((1 + 2) * 4) - 3'
     self.assertEqual(infix2postfix(task1), '5 1 2 + 4 * + 3 -')
     task2 = '(5 + 3) * 12 / 3'
     self.assertEqual(infix2postfix(task2), '5 3 + 12 * 3 /')
Exemplo n.º 5
0
 def test_can_deal_with_multiple_operators(self):
     self.assertEqual(infix2postfix('2 + 3*5'), '2 3 5 * +')
Exemplo n.º 6
0
 def test_returns_correct_result(self):
     self.assertEqual(infix2postfix('2 + 3'), '2 3 +')