Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store

__pycache__
./docs/_build/**
/pyCatSim/__pycache__
/pyCatSim/api/__pycache__
**/__pycache__
./docs/_build/**
32 changes: 32 additions & 0 deletions pyCatSim/api/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,35 @@ def __init__(self, name, cats_owned):

self.name = name
self.cats_owned = cats_owned

def groom(self,Cat):
"""
Simulates an owner grooming one cat, increasing its mood by one

Parameters
----------
Cat : pyCatSim.Cat
a pyCatSim.Cat object that you would like to groom.

Returns
-------
None.


Examples
--------
.. jupyter-execute::

from pyCatSim import Cat, Owner

cat1 = Cat(name="Whiskers")

Deborah = Owner(name="Deborah", cats_owned=cat1)

Deborah.groom(cat1)

"""

Cat.mood += 1


20 changes: 19 additions & 1 deletion pyCatSim/tests/test_api_Owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,22 @@ def test_init_t1(self):

assert owner1.name == 'Liam'
assert type(owner1.cats_owned) is list
assert len(owner1.cats_owned) == 2
assert len(owner1.cats_owned) == 2

class TesthumanActions:
''' Test for Owner action success '''

def test_groom_t0(self):
cat1 = Cat(name="Whiskers",mood=7)
owner1 = Owner(name="Sasha", cats_owned=cat1)

owner1.groom(cat1)

assert cat1.mood == 8







Loading