예제 #1
0
def test_zoo_5_animals():
    for animal in 'dog cat fish lion mouse'.split():
        Animal(animal)
    zoo = Animal.zoo()
    expected = ("10001. Dog", "10002. Cat", "10003. Fish", "10004. Lion",
                "10005. Mouse")
    assert zoo == '\n'.join(expected)
예제 #2
0
def test_zoo_5_animals():
    for animal in 'dog cat fish lion mouse'.split():
        Animal(animal)
    zoo = Animal.zoo()
    assert "10001. Dog" in zoo
    assert "10002. Cat" in zoo
    assert "10003. Fish" in zoo
    assert "10004. Lion" in zoo
    assert "10005. Mouse" in zoo
예제 #3
0
def test_animal_instance_str():
    horse = Animal('horse')
    assert str(horse) == "10006. Horse"
    horse = Animal('monkey')
    assert str(horse) == "10007. Monkey"
예제 #4
0
import sys
sys.path.append('../../lib/')
from zoo import Animal

a = Animal("zoo")
print(a.get_name())
예제 #5
0
def getAnimal():
    animal = Animal("name")
    return animal
예제 #6
0
 def test_Animal(self):
     with pytest.raises(TypeError) as excinfo:
         animal = Animal('Mammal', 1, 'Black')
     exception_message = excinfo.value.args[0]
     assert exception_message == "Can't instantiate abstract class Animal with abstract methods __init__, sound"