Skip to content
Open
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
6 changes: 3 additions & 3 deletions pyCatSim/api/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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')
Expand Down
8 changes: 5 additions & 3 deletions pyCatSim/tests/test_api_Cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'''
Expand All @@ -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."
]
]
Loading