Esempio n. 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)
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 5
0
def test_get_profile_no_name():
    with pytest.raises(TypeError):
        assert get_profile()
Esempio n. 6
0
def test_get_profile_two_sports():
    expected = {'name': 'tim', 'age': 36, 'sports': ['basketball', 'tennis']}
    assert get_profile('tim', 36, 'tennis', 'basketball') == expected
Esempio n. 7
0
def test_get_profile_one_sport():
    expected = {'name': 'tim', 'age': 36, 'sports': ['tennis']}
    assert get_profile('tim', 36, 'tennis') == expected
Esempio n. 8
0
def test_get_profile_dict():
    assert get_profile('tim', 36) == {'name': 'tim', 'age': 36}
Esempio n. 9
0
def test_get_profile_valueerror():
    with pytest.raises(ValueError):
        assert get_profile('tim', 'nonint')
Esempio n. 10
0
def test_get_profile_no_age():
    with pytest.raises(TypeError):
        assert get_profile('tim')