diff --git a/app/main.py b/app/main.py index a3caede7..ad7b6bad 100644 --- a/app/main.py +++ b/app/main.py @@ -23,9 +23,10 @@ def hide(self) -> None: class Carnivore(Animal): - def bite(self, herbivore: Herbivore) -> None: + @staticmethod + def bite(herbivore: Herbivore) -> None: if herbivore.hidden or isinstance(herbivore, Carnivore): return - herbivore.health = max(0, herbivore.health - 50) - if not herbivore.health: + herbivore.health -= 50 + if herbivore.health <= 0: Animal.alive.pop(Animal.alive.index(herbivore)) diff --git a/tests/test_main.py b/tests/test_main.py index 120bde31..dcdf42cd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -129,8 +129,6 @@ def test_print_animal_alive(): f = io.StringIO() - print(Animal.alive) - with redirect_stdout(f): print(Animal.alive)