def test_animal_should_die_if_power_equal_0(self): tiger = Predator(power=100, speed=70) self.jungle.add_animal(tiger) self.assertTrue(self.jungle.animals) tiger.current_power = 0 tiger.eat(self.jungle) self.assertFalse(self.jungle.animals)
def test_predator_try_to_hunt_someone_stronger(self): dog = Predator(power=10, speed=70) elephant = Herbivorous(power=100, speed=40) self.jungle.add_animal(elephant) dog.eat(self.jungle) self.assertEqual(dog.current_power, 7) self.assertEqual(elephant.current_power, 70)
def test_predator_try_to_hunt_someone_quicker(self): tiger = Predator(power=100, speed=70) horse = Herbivorous(power=100, speed=100) self.jungle.add_animal(horse) tiger.eat(self.jungle) self.assertEqual(tiger.current_power, 70) self.assertEqual(horse.current_power, 70)
def test_predator_catch_himself(self): tiger = Predator(power=100, speed=70) self.jungle.add_animal(tiger) tiger.eat(self.jungle) self.assertEqual(tiger.current_power, 70)