Coverage for kwai/modules/training/coaches/coach.py: 88%

16 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-09-05 17:55 +0000

1"""Module that defines a coach entity.""" 

2from kwai.core.domain.entity import Entity 

3from kwai.core.domain.value_objects.identifier import IntIdentifier 

4from kwai.core.domain.value_objects.name import Name 

5 

6CoachIdentifier = IntIdentifier 

7 

8 

9class CoachEntity(Entity[CoachIdentifier]): 

10 """A coach. 

11 

12 Attributes: 

13 _id: The id of the coach. 

14 _name: The name of the coach. 

15 """ 

16 

17 def __init__(self, *, id_: CoachIdentifier | None = None, name: Name, active: bool): 

18 super().__init__(id_ or CoachIdentifier()) 

19 self._id = id_ 

20 self._name = name 

21 self._active = active 

22 

23 @property 

24 def name(self) -> Name: 

25 """Return the name of the coach.""" 

26 return self._name 

27 

28 @property 

29 def is_active(self) -> bool: 

30 """Return True when the coach is still active, False otherwise.""" 

31 return self._active