Exemplo n.º 1
0
 def test_can_instatiate_birds():
     owl = Owl("Pip", 10, 10)
     print(owl)
     meat = Meat(4)
     print(owl.make_sound())
     owl.feed(meat)
     veg = Vegetable(1)
     print(owl.feed(veg))
     print(owl)
     hen = Hen("Harry", 10, 10)
     veg = Vegetable(3)
     fruit = Fruit(5)
     meat = Meat(1)
     print(hen)
     print(hen.make_sound())
     hen.feed(veg)
     hen.feed(fruit)
     hen.feed(meat)
     print(hen)
Exemplo n.º 2
0
print(gosheto)

owl = Owl("Pip", 10, 10)
print(owl)
meat = Meat(4)
print(owl.make_sound())
owl.feed(meat)
veg = Vegetable(1)
print(owl.feed(veg))
print(owl)
hen = Hen("Harry", 10, 10)
veg = Vegetable(3)
fruit = Fruit(5)
meat = Meat(1)
print(hen)
print(hen.make_sound())
hen.feed(veg)
hen.feed(fruit)
hen.feed(meat)
print(hen)


class WildFarmTests(unittest.TestCase):
    def test_first_zero(self):
        owl = Owl("Pip", 10, 10)
        self.assertEqual(str(owl), "Owl [Pip, 10, 10, 0]")
        meat = Meat(4)
        self.assertEqual(owl.make_sound(), "Hoot Hoot")
        owl.feed(meat)
        veg = Vegetable(1)
        owl.feed(veg)