Simple Animals Hierarchy

Extend the Animal class provided with three more subclasses: Cat, Dog, Human.

Include a method talk in each one of the subclasses. The talk method should return different options based on the type of animal:

  • Cat: should return "Meow!"
  • Dog: should return "Ruff!"
  • Human: should return "Hello!"
import unittest


class AnimalTestCase(unittest.TestCase):
    def test_animal_talk(self):
        cat = Cat()
        dog = Dog()
        human = Human()

        self.assertTrue(isinstance(cat, Animal))
        self.assertTrue(isinstance(dog, Animal))
        self.assertTrue(isinstance(human, Animal))

        self.assertEqual(cat.talk(), 'Meow!')
        self.assertEqual(dog.talk(), 'Ruff!')
        self.assertEqual(human.talk(), 'Hello!')