-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest_people.py
72 lines (52 loc) · 2.04 KB
/
test_people.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
""" pytest tests for people dictionary"""
from people import setup_people
def test_fry():
fry = setup_people()['Philip_Fry']
assert fry.first_name == 'Philip'
assert fry.age == 2040
assert fry.hobbies == []
def test_cartman():
cartman = setup_people()['Eric_Cartman']
assert cartman.first_name == 'Eric'
assert cartman.age == 10
assert cartman.hobbies == []
def test_bat_man():
bat_man = setup_people()['Bat_Man']
assert bat_man.first_name == 'Bat'
assert bat_man.age == 58
assert bat_man.hobbies == ['Justice', 'Seed']
def test_eeyore():
eeyore = setup_people()['Eeyore_Milne']
assert eeyore.first_name == 'Eeyore'
assert eeyore.age == 98
assert eeyore.hobbies == ['Being gloomy, eating thistles and sugar cubes, playing Poohsticks, going to birthday parties, flowers, stars, sad stories and poems, looking over his hill']
def test_road_runner():
road_runner = setup_people()['Road_Runner']
assert road_runner.first_name == 'Road'
assert road_runner.age == 71
assert road_runner.hobbies == ['running', 'seed']
def test_squanchy():
squanchy = setup_people()['squanchy_smith']
assert squanchy.first_name == 'squanchy'
assert squanchy.age == 21
assert squanchy.hobbies == ['squanching', 'running']
def test_scooby():
scooby = setup_people()['Scoobert_Doo']
assert scooby.first_name == 'Scoobert'
assert scooby.age == 7
assert scooby.pet == ''
assert scooby.hobbies == ['Eating Scooby Snacks']
def test_archer():
archer = setup_people()['Sterling_Archer']
assert archer.first_name == 'Sterling'
assert archer.pet == 'Babou'
assert archer.age == 36
assert archer.hobbies == ['Drinking', 'Being an ass', 'Super Spy']
def test_all_keys_match_names():
for key, person in setup_people().items():
assert key == f'{person.first_name}_{person.surname}'
def test_muttley():
muttley = setup_people()['Muttley_Dog']
assert muttley.first_name == 'Muttley'
assert muttley.age == 71
assert muttley.hobbies == 'Laughing'