Пример #1
0
 def test_unknown_operator(self):
     with pytest.raises(ValueError):
         calculate_prefix("& 1 2")
Пример #2
0
 def test_additional_operators(self):
     with pytest.raises(ValueError):
         calculate_prefix("+ - * 1 2")
Пример #3
0
 def test_additional_whitespace(self):
     assert calculate_prefix("     +    1   2    ") == 3
Пример #4
0
 def test_empty_string(self):
     with pytest.raises(ValueError):
         calculate_prefix("")
Пример #5
0
 def test_base_case(self):
     assert calculate_prefix("+ 1 2") == 3
Пример #6
0
 def test_single_number(self):
     assert calculate_prefix("3") == 3