Esempio n. 1
0
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())
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 5
0
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
Esempio n. 6
0
def test_get_life_point():
    """
    test getteur point de vie
    """
    test_animal = Animal("Test", 5, 10, "testing")
    assert test_animal.get_life_point() == 5