def test_dog2_class(self): """Test case: Should behave like Dog's class * Dog's speak method should return 'arf'. * Dog's 'legs' method should return the output of Mammal's legs method multiplied by 2. """ dog = Dog() dog2 = Dog2() self.assertEqual(dog2.speak(), dog.speak()) self.assertEqual(dog2.legs(), dog.legs()) # Option with no inheritance. dog3 = Dog3() self.assertEqual(dog3.speak(), dog.speak()) self.assertEqual(dog3.legs(), dog.legs())
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)