示例#1
0
def test_all_speaking():
    """
    test de la fonction feed_all_speaking zoo
    """
    test_animal1 = Dog("Test1", 5, 10, "hab-hab")
    test_animal2 = Dog("Test2", 10, 10, "grrr")
    enclo1 = Enclosure("test", [test_animal1, test_animal2])
    test_animal3 = Dog("Fox", 15, 10, "miao")
    test_animal4 = Cat("Miao", 20, 10, "myiiiao")
    enclo2 = Enclosure("enclos-0", [test_animal3, test_animal4])
    test_zoo = Zoo("zomba", [enclo1, enclo2])
    assert test_zoo.all_speaking(
    ) == str(enclo1.all_speaking() + "\n") + str(enclo2.all_speaking() + "\n")
示例#2
0
def test_all_speaking():
    """
    test: permet de retirer un Animal de la liste en fonction de sa position dans la liste
    """
    test_animal3 = Dog("Test3", 5, 10, "testing3")
    test_animal4 = Cat("Test4", 10, 10, "testing4")
    test_enclosure = Enclosure("test", [test_animal4, test_animal3])
    assert test_enclosure.all_speaking(
    ) == "l'animal Test4 dit :testing4\nl'animal Test3 dit :testing3\n"
示例#3
0
def test_all_speaking():
    """
    test all speaking
    """
    test_animal1 = Dog("Test1", 5, 10, "testing1")
    test_animal2 = Cat("Test2", 10, 10, "testing2")
    test_animal3 = Pigeon("Test3", 5, 10, "testing3")
    test_animal4 = Eagle("Test4", 10, 10, "testing4")
    test_enclosure = Enclosure(
        "test", [test_animal1, test_animal2, test_animal3, test_animal4])
    print(str(test_enclosure.all_speaking()))