Beispiel #1
0
 def test_zoo_tend_animal_no_budget(self):
     z = Zoo("Zoo", 250, 2, 2)
     z.add_animal(Lion("John", "m", 2), 100)
     z.add_animal(Tiger("Bill", "f", 4), 100)
     res = z.tend_animals()
     self.assertEqual(
         res, "You have no budget to tend the animals. They are unhappy.")
Beispiel #2
0
 def test_zoo_tend_animal_success(self):
     z = Zoo("Zoo", 500, 2, 2)
     z.add_animal(Lion("John", "m", 2), 100)
     z.add_animal(Tiger("Bill", "f", 4), 100)
     res = z.tend_animals()
     self.assertEqual(z._Zoo__budget, 205)
     self.assertEqual(
         res,
         "You tended all the animals. They are happy. Budget left: 205")
Beispiel #3
0
 def test_animal_status(self):
     z = Zoo("My Zoo", 500, 3, 3)
     z.add_animal(Lion("Leo", "Male", 3), 100)
     z.add_animal(Tiger("Tigy", "Female", 4), 100)
     z.add_animal(Cheetah("Chi", "Female", 2), 100)
     res = z.animals_status()
     self.assertEqual(
         res,
         "You have 3 animals\n----- 1 Lions:\nName: Leo, Age: 3, Gender: Male\n----- 1 Tigers:\nName: Tigy, Age: 4, Gender: Female\n----- 1 Cheetahs:\nName: Chi, Age: 2, Gender: Female"
     )
Beispiel #4
0
    def createAnimals():
        """ lol"""
        animal = True
        while animal:
            name = input("What is the name of the animal")
            type_of_food = input("What does the animal eat?")
            rating = input("What rating does the animal have?")
            species = input("What species is the animal?")

            if species == "Lion":
                Zoo.animals.append(Lion(name, type_of_food, rating))
            elif species == "Giraffe":
                Zoo.animals.append(Giraffe(name, type_of_food, rating))
            else:
                Zoo.animals.append(Hippo(name, type_of_food, rating))

            isThereMoreAnimals = input("Are there more animals to be added? ")
            if isThereMoreAnimals == "n":
                animal = False
Beispiel #5
0
 def test_hungry(self):
     lionState = Lion('hungry')
     self.assertEqual('hungry', lionState.state, 'state error')
Beispiel #6
0
 def test_tree_full(self):
     lionState = Lion('full')
     self.assertEqual('Lion see on tree', lionState.tree(), 'state error')
Beispiel #7
0
 def test_antilopa_full(self):
     lionState = Lion('full')
     self.assertEqual('Lion sleep', lionState.antilopa(), 'state error')
Beispiel #8
0
 def test_lion_repr(self):
     l = Lion("b", "f", 2)
     res = str(l)
     self.assertEqual(res, "Name: b, Age: 2, Gender: f")
Beispiel #9
0
 def test_tree_hungry(self):
     lionState = Lion('hungry')
     self.assertEqual('Lion sleep', lionState.tree(), 'state error')
Beispiel #10
0
 def test_lion_init(self):
     l = Lion("a", "m", 4)
     self.assertEqual(l.name, "a")
     self.assertEqual(l.gender, "m")
     self.assertEqual(l.age, 4)
Beispiel #11
0
 def test_zoo_add_animal_no_space(self):
     z = Zoo("My Zoo", 1500, 0, 10)
     res = z.add_animal(Lion("Neo", "Male", 2), 1000)
     self.assertEqual(res, "Not enough space for animal")
     self.assertEqual(len(z.animals), 0)
     self.assertEqual(z._Zoo__budget, 1500)
Beispiel #12
0
 def test_zoo_add_animal_no_budget(self):
     z = Zoo("My Zoo", 500, 6, 10)
     res = z.add_animal(Lion("Neo", "Male", 2), 1000)
     self.assertEqual(res, "Not enough budget")
     self.assertEqual(len(z.animals), 0)
     self.assertEqual(z._Zoo__budget, 500)
Beispiel #13
0
 def test_zoo_add_animal_success(self):
     z = Zoo("My Zoo", 1500, 6, 10)
     res = z.add_animal(Lion("Neo", "Male", 2), 1000)
     self.assertEqual(res, "Neo the Lion added to the zoo")
     self.assertEqual(len(z.animals), 1)
     self.assertEqual(z._Zoo__budget, 500)
        return f"You have {len(self.workers)} workers\n" \
               f"----- {len(keepers)} Keepers:\n" \
               f"{NEW_LINE.join(keepers)}\n" \
               f"----- {len(caretakers)} Caretakers:\n" \
               f"{NEW_LINE.join(caretakers)}\n" \
               f"----- {len(vets)} Vets:\n" \
               f"{NEW_LINE.join(vets)}"


zoo = Zoo("Zootopia", 3000, 5, 8)

# Animals creation
animals = [
    Cheetah("Cheeto", "Male", 2),
    Cheetah("Cheetia", "Female", 1),
    Lion("Simba", "Male", 4),
    Tiger("Zuba", "Male", 3),
    Tiger("Tigeria", "Female", 1),
    Lion("Nala", "Female", 4)
]

# Animal prices
prices = [200, 190, 204, 156, 211, 140]

# Workers creation
workers = [
    Keeper("John", 26, 100),
    Keeper("Adam", 29, 80),
    Keeper("Anna", 31, 95),
    Caretaker("Bill", 21, 68),
    Caretaker("Marie", 32, 105),
Beispiel #15
0
 def test_antilopa_hungry(self):
     lionState = Lion('hungry')
     self.assertEqual('Lion eat', lionState.antilopa(), 'state error')
Beispiel #16
0
 def test_hunter_hungry(self):
     lionState = Lion('hungry')
     self.assertEqual('Run Lion, RUN!', lionState.hunter(), 'state error')
Beispiel #17
0
 def test_lion_get_needs(self):
     l = Lion("b", "f", 2)
     res = l.get_needs()
     self.assertEqual(res, 50)
Beispiel #18
0
 def test_full(self):
     lionState = Lion('full')
     self.assertEqual('full', lionState.state, 'state error')
Beispiel #19
0
"The Proxy Example Use Case"

from lion import Lion

PROTEUS = Lion()
PROTEUS.tell_me_your_form()
PROTEUS.tell_me_the_future()
PROTEUS.tell_me_your_form()
PROTEUS.tell_me_the_future()
PROTEUS.tell_me_your_form()
PROTEUS.tell_me_the_future()
PROTEUS.tell_me_your_form()
PROTEUS.tell_me_the_future()
PROTEUS.tell_me_your_form()
PROTEUS.tell_me_the_future()