示例#1
0
文件: pet.py 项目: omegarekrut/auger
 def __init__(self, name, species, age=0):
     Animal.__init__(self, species, age)
     self._name = name
示例#2
0
def test_to_string():
    """
        Test de la fonction to_string
    """
    test_animal = Animal("Test", 5, 10, "testing")
    assert test_animal.to_string() == "Test a 5 PV et 10 PA et je dis testing"
示例#3
0
    def test_get_species(self):
        animal_instance = Animal('Dog', 12)
        self.assertEquals(animal_instance.get_species(), 'Dog')

        animal_instance = Animal('Dog', 12)
        self.assertEquals(animal_instance.get_species(), 'Dog')
示例#4
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
示例#5
0
def test_get_attack_point():
    """
    test getteur points d'attack
    """
    test_animal = Animal("Test", 5, 10, "testing")
    assert test_animal.get_attack_point() == 10
示例#6
0
def test_get_name():
    """
    test get de name
    """
    test_animal = Animal("Test")
    assert test_animal.get_name() == "Test"
示例#7
0
def test_get_voice():
    """
    test getteur de voix
    """
    test_animal = Animal("Test", 5, 10, "voice_1")
    assert test_animal.get_voice() == "voice_1"
示例#8
0
 def __init__(self, name, *args):
     Animal.__init__(self, *args)
     self._name = name
示例#9
0
def test_animal_1():
    """
        fonction pour tester Animal
    """
    mon_animal = Animal("zarafa")
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal.set_attack_point(5)
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal.set_life_point(100)
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal.set_voice("ba3aaaaw")
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal.eat()
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal.eat(20)
    print("TO_STRING: " + mon_animal.to_string())
    mon_animal_2 = Animal("7allouf")
    print("TO_STRING: " + mon_animal_2.to_string())
    mon_animal_2.set_life_point(200)
    mon_animal_2.set_attack_point(30)
    print("TO_STRING: " + mon_animal_2.to_string())
    mon_animal_2.set_voice("Grrrrrrrr")
    print("TO_STRING: " + mon_animal_2.to_string())
    mon_animal_2.eat(40)
    print("TO_STRING: " + mon_animal_2.to_string())
    mon_animal_2.attack(mon_animal)
    print("TO_STRING: " + mon_animal_2.to_string())
    print("TO_STRING: " + mon_animal.to_string())
    print("Execution de str():")
    print(str(mon_animal))
    print("print(mon_animal):")
    print(mon_animal)
示例#10
0
 def test_get_age(self):
     animal_instance = Animal('Dog', 12)
     self.assertEquals(animal_instance.get_age(), 12)