예제 #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 /")
예제 #2
0
 def test_can_deal_with_multiple_operators(self):
     self.assertEqual(infix2postfix("2 + 3*5"), "2 3 5 * +")
예제 #3
0
 def test_returns_correct_result(self):
     self.assertEqual(infix2postfix("2 + 3"), "2 3 +")
예제 #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 /')
예제 #5
0
 def test_can_deal_with_multiple_operators(self):
     self.assertEqual(infix2postfix('2 + 3*5'), '2 3 5 * +')
예제 #6
0
 def test_returns_correct_result(self):
     self.assertEqual(infix2postfix('2 + 3'), '2 3 +')