Coverage for src/kwai/modules/training/teams/team_tables.py: 100%

10 statements  

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

1"""Module that defines all dataclasses for the team tables.""" 

2 

3from dataclasses import dataclass 

4 

5from kwai.core.db.table import Table 

6from kwai.modules.training.teams.team import TeamEntity, TeamIdentifier 

7 

8 

9@dataclass(kw_only=True, frozen=True, slots=True) 

10class TeamRow: 

11 """Represent a row of the teams table.""" 

12 

13 id: int 

14 name: str 

15 

16 def create_entity(self) -> TeamEntity: 

17 """Create a Team entity of this row.""" 

18 return TeamEntity(id_=TeamIdentifier(self.id), name=self.name) 

19 

20 

21TeamsTable = Table("teams", TeamRow)