def test_mammal_class(self): """Test case: * Mammal should have a method called 'speak' that returns 'hello'. * Mammal should have a method called 'legs' that returns 2. * The output of 'legs' can be overwritten by modifying the _legs attribute of the Mammal class. """ mammal = Mammal() self.assertEqual(mammal.speak(), 'hello') self.assertEqual(mammal.legs(), 2) mammal._legs = 4 self.assertEqual(mammal.legs(), 4)
def test_dog_class(self): """Test case: * Dog's speak method should return 'arf'. * Dog's 'legs' method should return the output of Mammal's legs method multiplied by 2. """ mammal = Mammal() dog = Dog() self.assertEqual(dog.speak(), 'arf') self.assertEqual(dog.legs(), mammal.legs()*2)