Beispiel #1
0
def test_get_profile_too_many_sports():
    with pytest.raises(ValueError):
        sports = [
            'tennis', 'basketball', 'badminton', 'baseball', 'volleyball',
            'boxing'
        ]
        assert get_profile('tim', 36, *sports)
Beispiel #2
0
def test_get_profile_award():
    expected = {
        'name': 'tim',
        'age': 36,
        'awards': {
            'champ': 'helped out team in crisis'
        }
    }
    assert get_profile('tim', 36,
                       champ='helped out team in crisis') == expected
Beispiel #3
0
def test_get_profile_two_sports_and_one_award():
    expected = {
        'name': 'tim',
        'age': 36,
        'sports': ['basketball', 'tennis'],
        'awards': {
            'champ': 'helped out team in crisis'
        }
    }
    assert get_profile('tim',
                       36,
                       'tennis',
                       'basketball',
                       champ='helped out team in crisis') == expected
Beispiel #4
0
def test_get_profile_two_sports_and_three_awards():
    expected = {
        'name': 'tim',
        'age': 36,
        'sports': ['basketball', 'tennis'],
        'awards': {
            'champ': 'helped out the team in crisis',
            'service': 'going the extra mile for our customers',
            'attitude': 'unbeatable positive + uplifting'
        }
    }
    assert get_profile('tim',
                       36,
                       'tennis',
                       'basketball',
                       service='going the extra mile for our customers',
                       champ='helped out the team in crisis',
                       attitude='unbeatable positive + uplifting') == expected
Beispiel #5
0
def test_get_profile_no_name():
    with pytest.raises(TypeError):
        assert get_profile()
Beispiel #6
0
def test_get_profile_two_sports():
    expected = {'name': 'tim', 'age': 36, 'sports': ['basketball', 'tennis']}
    assert get_profile('tim', 36, 'tennis', 'basketball') == expected
Beispiel #7
0
def test_get_profile_one_sport():
    expected = {'name': 'tim', 'age': 36, 'sports': ['tennis']}
    assert get_profile('tim', 36, 'tennis') == expected
Beispiel #8
0
def test_get_profile_dict():
    assert get_profile('tim', 36) == {'name': 'tim', 'age': 36}
Beispiel #9
0
def test_get_profile_valueerror():
    with pytest.raises(ValueError):
        assert get_profile('tim', 'nonint')
Beispiel #10
0
def test_get_profile_no_age():
    with pytest.raises(TypeError):
        assert get_profile('tim')