diff --git a/pyCatSim/api/cat.py b/pyCatSim/api/cat.py index 5d90543..849365c 100644 --- a/pyCatSim/api/cat.py +++ b/pyCatSim/api/cat.py @@ -331,7 +331,7 @@ def eat(self): return {"hunger_level": self.hunger_level, "mood": self.mood} - def sleep(self, duration=0): + def sleep(self, duration): """ Simulates the cat getting some sleep. @@ -342,7 +342,7 @@ def sleep(self, duration=0): Parameters ---------- - duration : int or float, optional + duration : int or float Number of hours the cat sleeps. Must be an integer or float. The default is 0. Raises @@ -355,7 +355,7 @@ def sleep(self, duration=0): Examples -------- - ..jupyter-execute:: + .. jupyter-execute:: import pyCatSim as cats nutmeg = cats.Cat(name='Nutmeg', age = 3, color = 'tortoiseshell') diff --git a/pyCatSim/tests/test_api_Cat.py b/pyCatSim/tests/test_api_Cat.py index a5b949e..a403f7b 100644 --- a/pyCatSim/tests/test_api_Cat.py +++ b/pyCatSim/tests/test_api_Cat.py @@ -162,7 +162,7 @@ class TestcatCatSleep: [ (0), (1), - (4.4), + (14.4), pytest.param("kitty", marks=pytest.mark.xfail), pytest.param(-1, marks=pytest.mark.xfail), pytest.param(17, marks=pytest.mark.xfail) @@ -175,7 +175,9 @@ def test_sleep_t0(self, duration): if duration < 3: assert cat.energy == 0 - + + if (duration >= 12) and (duration < 15): + assert cat.energy == 4 class TestcatCatFact: ''' Test for the give_fact function''' @@ -197,4 +199,4 @@ def test_give_fact_t0(self): "Cats use their whiskers to detect changes in their surroundings.", "The average house cat can run at speeds up to 30 mph.", "Cats meow only to communicate with humans." - ] \ No newline at end of file + ]