|
@@ -3,6 +3,21 @@ import typing
|
|
|
|
|
|
|
|
|
class Person:
|
|
|
+
|
|
|
+ """
|
|
|
+ >>> alice = Person('alice')
|
|
|
+ >>> alice.name = 'Alice Test'
|
|
|
+ >>> alice.birth_date = datetime.date(2019, 12, 23)
|
|
|
+ >>> alice
|
|
|
+ Person(alice, Alice Test, *2019-12-23)
|
|
|
+ >>> str(alice)
|
|
|
+ 'Alice Test (*2019-12-23)'
|
|
|
+
|
|
|
+ >>> bob = Person('bob')
|
|
|
+ >>> bob.name = 'Bob Test'
|
|
|
+ >>> alice.father = bob
|
|
|
+ """
|
|
|
+
|
|
|
def __init__(self, identifier: str):
|
|
|
self.identifier: str = identifier
|
|
|
self.name: typing.Optional[str] = None
|
|
@@ -98,6 +113,22 @@ class Person:
|
|
|
|
|
|
|
|
|
class PersonCollection:
|
|
|
+
|
|
|
+ """
|
|
|
+ >>> bob = Person('bob')
|
|
|
+ >>> bob.name = 'Bob Test'
|
|
|
+ >>> alice = Person('alice')
|
|
|
+ >>> alice.name = 'Alice Test'
|
|
|
+ >>> alice.father = bob
|
|
|
+ >>> collection = PersonCollection()
|
|
|
+ >>> collection.add_person(alice)
|
|
|
+ Person(alice, Alice Test)
|
|
|
+ >>> for person in collection:
|
|
|
+ ... print(person.name)
|
|
|
+ Bob Test
|
|
|
+ Alice Test
|
|
|
+ """
|
|
|
+
|
|
|
def __init__(self):
|
|
|
self._persons = {}
|
|
|
self.__it = None
|