forked from keeppythonweird/catinabox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_cattery.py
39 lines (28 loc) · 1.04 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
import pytest
from catinabox import cattery
###########################################################################
# add_cats
###########################################################################
def test__add_cats__succeeds():
c = cattery.Cattery()
c.add_cats(["Fluffy", "Snookums"])
assert c.cats == ["Fluffy", "Snookums"]
assert c.num_cats == 2
###########################################################################
# remove_cat
###########################################################################
def test__remove_cat__succeeds():
c = cattery.Cattery()
c.add_cats(["Fluffy", "Junior"])
c.remove_cat("Fluffy")
assert c.cats == ["Junior"]
assert c.num_cats == 1
def test__remove_cat__no_cats__fails():
c = cattery.Cattery()
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Fluffles")
def test__remove_cat__cat_not_in_cattery__fails():
c = cattery.Cattery()
c.add_cats(["Fluffy"])
with pytest.raises(cattery.CatNotFound):
c.remove_cat("Snookums")