Esempio n. 1
0
def test_to_string():
    """
    fonction to_string_zoo
    """
    test_animal1 = Dog("Fox", 5, 10, "testing")
    test_animal2 = Cat("Miao", 10, 10, "testing2")
    test_enclosure1 = Enclosure("enclos-0", [test_animal1, test_animal2])
    test_animal = Dog("Rex", 5, 10, "testing2", 4)
    test_animal3 = Cat("kitty", 5, 10, "testing2", 4)
    test_enclosure2 = Enclosure("enclos-1", [test_animal, test_animal3])
    test_zoo = Zoo("zomba", [test_enclosure1, test_enclosure2])
    msg = "Le zoo appelé zomba contient : \n" + str(
        test_enclosure1.to_string() + "\n") + str(test_enclosure2.to_string() +
                                                  "\n")
    assert test_zoo.to_string() == msg
Esempio n. 2
0
def enclos_to_string():
    """
    fonction to_string
    """
    test_animal1 = Dog("Rex", 5, 10, "testing2", 4)
    test_animal2 = Cat("kitty", 5, 10, "testing2", 4)
    test_enclosure = Enclosure("enclos-1",
                               list_animaux=[test_animal1, test_animal2])
    print(str(test_enclosure.to_string()))
Esempio n. 3
0
def test_to_string():
    """
    fonction to_string
    """
    test_animal1 = Dog("Fox", 5, 10, "testing")
    test_animal2 = Cat("Miao", 10, 10, "testing2")
    test_enclosure = Enclosure("enclos-1",
                               list_animaux=[test_animal1, test_animal2])
    msg = "L enclos appelé enclos-1 contient :\nFox a 5 PV et 10 PA et je dis testing et j'ai 4 pattes\nMiao a 10 PV et 10 PA et je dis testing2 et j'ai 4 pattes\n"
    assert test_enclosure.to_string() == msg
Esempio n. 4
0
def test_all_attacking():
    """
    test:permet de faire attacker les animaux
    """
    dog_0 = Dog("Dog-0", 5, 10, "Voice-Dog-0")
    dog_1 = Dog("Dog-1", 5, 20, "Voice-Dog-1")
    dog_2 = Dog("Dog-2", 5, 10, "Voice-Dog-2")
    dog_3 = Dog("Dog-3", 50, 10, "Voice-Dog-3")
    dog_4 = Dog("Dog-4", 5, 20, "Voice-Dog-4")
    dog_5 = Dog("Dog-5", 15, 10, "Voice-Dog-5")
    dog_6 = Dog("Dog-6", 50, 20, "Voice-Dog-6")
    dog_7 = Dog("Dog-7", 5, 30, "Voice-Dog-7")

    enclosure_0 = Enclosure(
        "Enclos-0", [dog_0, dog_1, dog_2, dog_3, dog_4, dog_5, dog_6, dog_7])
    print("=== Before attack:")
    print(str(enclosure_0.to_string()))
    print("=== After attack:")
    enclosure_0.all_attacking()
    print(str(enclosure_0.to_string()))