コード例 #1
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_unknown_operator(self):
     with pytest.raises(ValueError):
         calculate_prefix("& 1 2")
コード例 #2
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_additional_operators(self):
     with pytest.raises(ValueError):
         calculate_prefix("+ - * 1 2")
コード例 #3
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_additional_whitespace(self):
     assert calculate_prefix("     +    1   2    ") == 3
コード例 #4
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_empty_string(self):
     with pytest.raises(ValueError):
         calculate_prefix("")
コード例 #5
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_base_case(self):
     assert calculate_prefix("+ 1 2") == 3
コード例 #6
0
ファイル: test_calculator.py プロジェクト: mawall/calculator
 def test_single_number(self):
     assert calculate_prefix("3") == 3