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