def test_animals_abs_and_inheritance(self): self.assertEqual(Animal.__bases__[0].__name__, "ABC") self.assertTrue(len(list(Animal.__abstractmethods__)) > 0) self.assertTrue("Animal" in [x.__name__ for x in Bird.__bases__]) self.assertTrue("ABC" in [x.__name__ for x in Bird.mro()]) self.assertTrue("Animal" in [x.__name__ for x in Mammal.__bases__]) self.assertTrue("ABC" in [x.__name__ for x in Mammal.mro()]) self.assertEqual(Mouse.__bases__[0].__name__, "Mammal") self.assertEqual(Dog.__bases__[0].__name__, "Mammal") self.assertEqual(Tiger.__bases__[0].__name__, "Mammal") self.assertEqual(Cat.__bases__[0].__name__, "Mammal") self.assertEqual(Owl.__bases__[0].__name__, "Bird") self.assertEqual(Hen.__bases__[0].__name__, "Bird")
def __init__(self, name, weight, living_region): Mammal.__init__(self, name, weight, living_region)
def __init__(self, name, weight, living_region, food_eaten=0): Mammal.__init__(self, name, weight, living_region, food_eaten)