Пример #1
0
def test_div_par(number1, number2, number3):
    assert div1(number1, number2) == number3
Пример #2
0
def test_div_error():
    # 预期为异常需要用到该语句
    with pytest.raises(ZeroDivisionError):
        div1(10, 0)
Пример #3
0
def test_div_float():
    assert div1(100.8, 2) == 50.4
Пример #4
0
def test_div_type():
    assert div1('aa', 123) == 0
Пример #5
0
def test_div_int():
    assert div1(10, 2) == 5