def setUp(self) -> None: self.person = Person("John", "Lennon") self.person2 = Person("Michael", "Jordan") self.group = Group("Special", [self.person, self.person2]) self.p1 = Person("Adam", "Sandal") self.p2 = Person("Johann", "Strauss") self.p3 = Person("Freddie", "Mercury") self.group2 = Group("VIP", [self.p1, self.p2, self.p3]) self.group3 = self.group + self.group2
from project.child import Child from project.person import Person person = Person("Peter", 25) child = Child("Peter Junior", 5) print(person.name) print(person.age) print(child.__class__.__bases__[0].__name__)
def __init__(self, name, age): Person.__init__(self, name, age)
def setUp(self) -> None: self.person = Person("John", "Lennon") self.person2 = Person("Michael", "Jordan")
def test_person(self): p = Person() res = p.sleep() self.assertEqual(res, "sleeping...")
from project.person import Person c = Person('Goshko', 2) c.make_sound() print(c.__dict__)