コード例 #1
0
def test_one_positional_arg():
    with pytest.raises(TypeError):
        get_profile('julian')
コード例 #2
0
def test_no_arguments():
    assert get_profile() == 'julian is a programmer'
コード例 #3
0
def test_two_correct_kws():
    ret = get_profile(name='bob', profession='software developer')
    assert ret == 'bob is a software developer'
コード例 #4
0
def test_correct_kw_second_default():
    assert get_profile(name='bob') == 'bob is a programmer'
コード例 #5
0
def test_wrong_additional_kw():
    with pytest.raises(TypeError):
        get_profile(name='bob',
                    profession='software developer',
                    another_flag=False)
コード例 #6
0
def test_wrong_single_kw():
    with pytest.raises(TypeError):
        get_profile(test=True)