Refactored Animals

Expand the previous assignment so the classes Cat, Dog and Human receive a parameter when created what_i_say_when_talk (and store it as an attribute). The talk method should be now in the Animal class. The talk method should use the what_i_say_when_talk attribute . Example:

cat = Cat('Meow!')
dog = Dog('Ruff!')
human1 = Human('Hello!')
human2 = Human('World!')

cat.talk()     # 'Meow!'
dog.talk()     # 'Ruff!'
human1.talk()  # 'Hello!'
human2.talk()  # 'World!'
import unittest


class AnimalTestCase(unittest.TestCase):
    def test_animal_talk(self):
        cat = Cat('Meow!')
        dog = Dog('Ruff!')
        human1 = Human('Hello!')
        human2 = Human('World!')

        self.assertTrue(isinstance(cat, Animal))
        self.assertTrue(isinstance(dog, Animal))
        self.assertTrue(isinstance(human1, Animal))
        self.assertTrue(isinstance(human2, Animal))

        self.assertEqual(cat.talk(), 'Meow!')
        self.assertEqual(dog.talk(), 'Ruff!')
        self.assertEqual(human1.talk(), 'Hello!')
        self.assertEqual(human2.talk(), 'World!')