Skip to content

Commit 66d3c70

Browse files
authored
Merge pull request #33 from nickmckay/main
groom
2 parents 73d5cb9 + c0e7d1c commit 66d3c70

3 files changed

Lines changed: 55 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2-
3-
__pycache__
4-
./docs/_build/**
2+
/pyCatSim/__pycache__
3+
/pyCatSim/api/__pycache__
4+
**/__pycache__
5+
./docs/_build/**

pyCatSim/api/human.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,35 @@ def __init__(self, name, cats_owned):
6060

6161
self.name = name
6262
self.cats_owned = cats_owned
63+
64+
def groom(self,Cat):
65+
"""
66+
Simulates an owner grooming one cat, increasing its mood by one
67+
68+
Parameters
69+
----------
70+
Cat : pyCatSim.Cat
71+
a pyCatSim.Cat object that you would like to groom.
72+
73+
Returns
74+
-------
75+
None.
76+
77+
78+
Examples
79+
--------
80+
.. jupyter-execute::
81+
82+
from pyCatSim import Cat, Owner
83+
84+
cat1 = Cat(name="Whiskers")
85+
86+
Deborah = Owner(name="Deborah", cats_owned=cat1)
87+
88+
Deborah.groom(cat1)
89+
90+
"""
91+
92+
Cat.mood += 1
93+
94+

pyCatSim/tests/test_api_Owner.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,22 @@ def test_init_t1(self):
4040

4141
assert owner1.name == 'Liam'
4242
assert type(owner1.cats_owned) is list
43-
assert len(owner1.cats_owned) == 2
43+
assert len(owner1.cats_owned) == 2
44+
45+
class TesthumanActions:
46+
''' Test for Owner action success '''
47+
48+
def test_groom_t0(self):
49+
cat1 = Cat(name="Whiskers",mood=7)
50+
owner1 = Owner(name="Sasha", cats_owned=cat1)
51+
52+
owner1.groom(cat1)
53+
54+
assert cat1.mood == 8
55+
56+
57+
58+
59+
60+
61+

0 commit comments

Comments
 (0)