forked from keeppythonweird/catinabox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_cattery.py
64 lines (48 loc) · 2.13 KB
/
test_cattery.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
import pytest
from catinabox import cattery
class TestCattery(object):
###########################################################################
# add_cats
###########################################################################
def test__add_cats__succeeds(self):
c = cattery.Cattery()
assert False
###########################################################################
# remove_cat
###########################################################################
def test__remove_cat__succeeds(self):
c = cattery.Cattery()
assert False
def test__remove_cat__no_cats__fails(self):
c = cattery.Cattery()
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Snookums")
def test__remove_cat__cat_not_in_cattery__fails(self):
c = cattery.Cattery()
c.add_cats(["Fluffy"])
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Snookums")
###########################################################################
# feed_cats
###########################################################################
def test__feed_cats__succeeds(self):
c = cattery.Cattery()
c.add_cats(["Fluffy", "Snookums"])
c.feed_cats(["burger", "salmon"])
assert c.cats == [{"name": "Fluffy", "food_eaten": ["burger"]},
{"name": "Snookums", "food_eaten": ["salmon"]}]
def test__feed_cats__not_enough_food__fails(self):
c = cattery.Cattery()
c.add_cats(["Fluffy", "Snookums"])
with pytest.raises(cattery.NotEnoughFood):
c.feed_cats(["burger"])
def test__feed_cats__no_cats__wastes_food(self):
c = cattery.Cattery()
c.feed_cats(["burger", "salmon", "pizza"])
assert c.cats == []
def test__feed_cats__too_much_food__wastes_food(self):
c = cattery.Cattery()
c.add_cats(["Fluffy", "Snookums"])
c.feed_cats(["burger", "salmon", "pizza"])
assert c.cats == [{"name": "Fluffy", "food_eaten": ["burger"]},
{"name": "Snookums", "food_eaten": ["salmon"]}]