예제 #1
0
def test_divide():
    """test both integer and float divition"""
    assert specs.divide(4, 2) == 2, "integer division"
    assert specs.divide(5, 4) == 1.25, "float division"
    with pytest.raises(ZeroDivisionError) as excinfo:
        specs.divide(4, 0)  #cant have 0 denominator
    assert excinfo.value.args[0] == "second input cannot be zero"
def test_divide():
    assert specs.divide(4, 2) == 2, "integer division"
    assert specs.divide(5, 4) == 1.25, "float division"
    with pytest.raises(ZeroDivisionError) as excinfo:
        specs.divide(4, 0)
    assert excinfo.value.args[0] == "second input cannot be zero"