Beispiel #1
0
 def test_zoo_pay_worker_no_budget(self):
     z = Zoo("Zoo", 200, 2, 2)
     z.hire_worker(Vet("John", 23, 100))
     z.hire_worker(Keeper("Bill", 28, 150))
     res = z.pay_workers()
     self.assertEqual(
         res, "You have no budget to pay your workers. They are unhappy")
Beispiel #2
0
 def test_zoo_pay_worker_success(self):
     z = Zoo("Zoo", 1500, 2, 2)
     z.hire_worker(Vet("John", 23, 100))
     z.hire_worker(Keeper("Bill", 28, 150))
     res = z.pay_workers()
     self.assertEqual(z._Zoo__budget, 1250)
     self.assertEqual(
         res, "You payed your workers. They are happy. Budget left: 1250")
Beispiel #3
0
 def test_worker_status(self):
     z = Zoo("My Zoo", 500, 3, 3)
     z.hire_worker(Vet("Leo", 35, 100))
     z.hire_worker(Keeper("Tigy", 40, 100))
     z.hire_worker(Caretaker("Chi", 24, 100))
     res = z.workers_status()
     self.assertEqual(
         res,
         "You have 3 workers\n----- 1 Keepers:\nName: Tigy, Age: 40, Salary: 100\n----- 1 Caretakers:\nName: Chi, Age: 24, Salary: 100\n----- 1 Vets:\nName: Leo, Age: 35, Salary: 100"
     )
Beispiel #4
0
 def test_vet_repr(self):
     k = Vet("ally", 36, 190)
     res = str(k)
     self.assertEqual(res, "Name: ally, Age: 36, Salary: 190")
Beispiel #5
0
 def test_vet_init(self):
     k = Vet("john", 21, 200)
     self.assertEqual(k.name, "john")
     self.assertEqual(k.age, 21)
     self.assertEqual(k.salary, 200)
Beispiel #6
0
 def test_zoo_hire_worker_no_space(self):
     z = Zoo("Some Zoo", 1500, 1, 0)
     res = z.hire_worker(Vet("I am Vet", 20, 500))
     self.assertEqual(res, "Not enough space for worker")
     self.assertEqual(len(z.workers), 0)
     self.assertEqual(z._Zoo__workers_capacity, 0)
Beispiel #7
0
 def test_zoo_hire_worker_success(self):
     z = Zoo("Some Zoo", 1500, 1, 1)
     res = z.hire_worker(Vet("I am Vet", 20, 500))
     self.assertEqual(res, "I am Vet the Vet hired successfully")
     self.assertEqual(len(z.workers), 1)
     self.assertEqual(z._Zoo__workers_capacity, 1)