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

16 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2024-01-01 00:00 +0000

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

2 

3from kwai.core.domain.entity import Entity 

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

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

6 

7 

8CoachIdentifier = IntIdentifier 

9 

10 

11class CoachEntity(Entity[CoachIdentifier]): 

12 """A coach. 

13 

14 Attributes: 

15 _id: The id of the coach. 

16 _name: The name of the coach. 

17 """ 

18 

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

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

21 self._id = id_ 

22 self._name = name 

23 self._active = active 

24 

25 @property 

26 def name(self) -> Name: 

27 """Return the name of the coach.""" 

28 return self._name 

29 

30 @property 

31 def is_active(self) -> bool: 

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

33 return self._active