def test_feeding_enclo(): """ fonction test_feeding_enclo """ test_animal1 = Animal("Test1", 5, 10, "testing1") test_animal2 = Animal("Test2", 10, 10, "testing2") test_enclosure = Enclosure("test", [test_animal1, test_animal2]) test_enclosure.feed_all(50) print(test_animal1.get_life_point()) print(test_animal2.get_life_point())
def test_feed_all(): """ test:permet de retirer un Animal de la liste en fonction de sa position dans la liste """ test_animal1 = Animal("Test1", 5, 10, "testing1") test_animal2 = Animal("Test2", 10, 10, "testing2") test_enclosure = Enclosure("test", [test_animal1, test_animal2]) test_enclosure.feed_all() assert test_animal1.get_life_point() == 10 assert test_animal2.get_life_point() == 15
def test_eat(): """ Test de la fonction eat """ test_animal = Animal(name="Test", life_point=5, attack_point=10, voice="testing") test_animal.eat() assert test_animal.get_life_point() == 10 test_animal.eat(energy=50) assert test_animal.get_life_point() == 60
def test_feed_all(): """ test de la fonction feed_all zoo """ test_animal1 = Animal("Test1", 5, 10, "testing1") test_animal2 = Animal("Test2", 10, 10, "testing2") test_enclosure1 = Enclosure("test", [test_animal1, test_animal2]) test_animal3 = Dog("Fox", 15, 10, "testing") test_animal4 = Cat("Miao", 20, 10, "testing2") test_enclosure2 = Enclosure("enclos-0", [test_animal3, test_animal4]) test_zoo = Zoo("zomba", [test_enclosure1, test_enclosure2]) test_zoo.feed_all(5) assert test_animal1.get_life_point() == 10 assert test_animal2.get_life_point() == 15 assert test_animal3.get_life_point() == 20 assert test_animal4.get_life_point() == 25
def test_attack(): """ Test de la fonction attack """ test_attacking = Animal("Test", 5, 2, "KILL") test_victim = Animal("Test2", 10, 1, "HELP") test_attacking.attack(test_victim) assert test_victim.get_life_point() == 8
def test_get_life_point(): """ test getteur point de vie """ test_animal = Animal("Test", 5, 10, "testing") assert test_animal.get_life_point() == 5