Ejemplo n.º 1
0
def test_perfnum_1():
    n = 28
    ret_val = perfect_num(n)
    assert ret_val == True
Ejemplo n.º 2
0
def test_other_perfnum():
    n = [1, 2, 3]
    with pytest.raises(TypeError) as err:
        perfect_num(n)
        assert err.value.args[0] == "unsupported format"
Ejemplo n.º 3
0
def test_not_perfnum_2():
    n = 1
    ret_val = perfect_num(n)
    assert ret_val == False
Ejemplo n.º 4
0
def test_bool_perfnum():
    n = True
    with pytest.raises(TypeError) as err:
        perfect_num(n)
        assert err.value.args[0] == "unsupported format"
Ejemplo n.º 5
0
def test_perfnum_2():
    n = 6, 28, 496
    for i in n:
        ret_val = perfect_num(i)
        assert ret_val == True