예제 #1
0
def test_addition():
    assert solver.basic_operation(1, 1, solver.Operator.ADDITION) == 2
예제 #2
0
def test_not_numbers1():
    with pytest.raises(TypeError):
        solver.basic_operation('5', 0, solver.Operator.ADDITION)
예제 #3
0
def test_not_numbers2():
    with pytest.raises(TypeError):
        solver.basic_operation('5', 'm', solver.Operator.POWER)
예제 #4
0
def test_zero_division():
    with pytest.raises(ZeroDivisionError):
        solver.basic_operation(5, 0, solver.Operator.DIVISION)
예제 #5
0
def test_power():
    assert solver.basic_operation(5, 3, solver.Operator.POWER) == 125
예제 #6
0
def test_division():
    assert solver.basic_operation(5, 2, solver.Operator.DIVISION) == 2.5
예제 #7
0
def test_product():
    assert solver.basic_operation(5, 3, solver.Operator.PRODUCT) == 15
예제 #8
0
def test_substraction():
    assert solver.basic_operation(5.6, 2,
                                  solver.Operator.SUBSTRACTION) == 5.6 - 2