Exemplo n.º 1
0
 def test_eval_reverse_polish_notation_string_simple_sum(self):
     val = "2 3 /"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(float(2) / 3, res)
Exemplo n.º 2
0
 def test_eval_reverse_polish_notation_string_simple_sub(self):
     val = "2 3 -"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(-1, res)
Exemplo n.º 3
0
 def test_eval_reverse_polish_notation_string_simple_multiply(self):
     val = "2 3 *"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(6, res)
Exemplo n.º 4
0
 def test_eval_reverse_polish_notation_empty_string(self):
     res = ValueEvaluator.eval_reverse_polish_notation("")
     self.assertIsNone(res)
Exemplo n.º 5
0
 def test_eval_reverse_polish_notation_string_none(self):
     res = ValueEvaluator.eval_reverse_polish_notation(None)
     self.assertIsNone(res)
Exemplo n.º 6
0
 def test_eval_reverse_polish_notation_string_simple_sum(self):
     val = "2 3 /"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(float(2) / 3, res)
Exemplo n.º 7
0
 def test_eval_reverse_polish_notation_string_simple_multiply(self):
     val = "2 3 *"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(6, res)
Exemplo n.º 8
0
 def test_eval_reverse_polish_notation_string_simple_sub(self):
     val = "2 3 -"
     res = ValueEvaluator.eval_reverse_polish_notation(val)
     self.assertEqual(-1, res)
Exemplo n.º 9
0
 def test_eval_reverse_polish_notation_string_none(self):
     res = ValueEvaluator.eval_reverse_polish_notation(None)
     self.assertIsNone(res)
Exemplo n.º 10
0
 def test_eval_reverse_polish_notation_empty_string(self):
     res = ValueEvaluator.eval_reverse_polish_notation("")
     self.assertIsNone(res)