Ejemplo n.º 1
0
 def test_unknown_operator(self):
     with pytest.raises(ValueError):
         calculate_prefix("& 1 2")
Ejemplo n.º 2
0
 def test_additional_operators(self):
     with pytest.raises(ValueError):
         calculate_prefix("+ - * 1 2")
Ejemplo n.º 3
0
 def test_additional_whitespace(self):
     assert calculate_prefix("     +    1   2    ") == 3
Ejemplo n.º 4
0
 def test_empty_string(self):
     with pytest.raises(ValueError):
         calculate_prefix("")
Ejemplo n.º 5
0
 def test_base_case(self):
     assert calculate_prefix("+ 1 2") == 3
Ejemplo n.º 6
0
 def test_single_number(self):
     assert calculate_prefix("3") == 3