diff --git a/.gitignore b/.gitignore index c4580b1..d33afcc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store - -__pycache__ -./docs/_build/** \ No newline at end of file +/pyCatSim/__pycache__ +/pyCatSim/api/__pycache__ +**/__pycache__ +./docs/_build/** diff --git a/pyCatSim/api/human.py b/pyCatSim/api/human.py index 568e790..6d92ad5 100644 --- a/pyCatSim/api/human.py +++ b/pyCatSim/api/human.py @@ -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 + + diff --git a/pyCatSim/tests/test_api_Owner.py b/pyCatSim/tests/test_api_Owner.py index a128747..c755f32 100644 --- a/pyCatSim/tests/test_api_Owner.py +++ b/pyCatSim/tests/test_api_Owner.py @@ -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 \ No newline at end of file + 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 + + + + + + + \ No newline at end of file