def test_do_math_advanced_error(operation, operand1, operand2, err_message): """Test simple math expressions""" with pytest.raises(ZeroDivisionError) as excinfo: do_math(operation, operand1, operand2) exception_message = excinfo.value.args[0] assert exception_message == f"{err_message}"
def test_do_math_simple_float_success(operation, operand1, operand2, expected): """Test simple math expressions""" assert do_math(operation, operand1, operand2) == pytest.approx(expected, 0.001)
def test_do_math_simple_int_success(operation, operand1, operand2, expected): """Test simple math expressions""" assert do_math(operation, operand1, operand2) == expected
def test_do_math_bitwise(operation, operand1, operand2, expected): """Test simple math expressions""" assert do_math(operation, operand1, operand2) == expected
def test_do_math_syntax_error(symbol): """Test incorrect simple math expressions""" with pytest.raises(SyntaxError) as excinfo: do_math(symbol, "/", 2) exception_message = excinfo.value.args[0] assert exception_message == f"invalid syntax"